@pie-element/multi-trait-rubric 2.5.1-beta.1 → 2.5.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure/lib/common.js +467 -0
- package/configure/lib/common.js.map +1 -0
- package/configure/lib/defaults.js +93 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +94 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +419 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/modals.js +329 -0
- package/configure/lib/modals.js.map +1 -0
- package/configure/lib/scale.js +469 -0
- package/configure/lib/scale.js.map +1 -0
- package/configure/lib/trait.js +300 -0
- package/configure/lib/trait.js.map +1 -0
- package/configure/lib/traitsHeader.js +223 -0
- package/configure/lib/traitsHeader.js.map +1 -0
- package/configure/lib/utils.js +27 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +4 -4
- package/controller/lib/defaults.js +93 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +100 -0
- package/controller/lib/index.js.map +1 -0
- package/lib/index.js +64 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +110 -0
- package/lib/main.js.map +1 -0
- package/lib/scale.js +181 -0
- package/lib/scale.js.map +1 -0
- package/lib/trait.js +89 -0
- package/lib/trait.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.TraitTile = exports.StyledTrait = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _react = _interopRequireDefault(require("react"));
|
|
16
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
19
|
+
var _reactDnd = require("react-dnd");
|
|
20
|
+
var _styles = require("@material-ui/core/styles");
|
|
21
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
22
|
+
var _common = require("./common");
|
|
23
|
+
var _utils = require("./utils");
|
|
24
|
+
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
25
|
+
var _MoreVert = _interopRequireDefault(require("@material-ui/icons/MoreVert"));
|
|
26
|
+
var _Menu = _interopRequireDefault(require("@material-ui/core/Menu"));
|
|
27
|
+
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
28
|
+
var _DragIndicator = _interopRequireDefault(require("@material-ui/icons/DragIndicator"));
|
|
29
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
30
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
+
var log = (0, _debug["default"])('@pie-element:placement-ordering:configure:trait-tile');
|
|
32
|
+
var styles = {
|
|
33
|
+
actions: {
|
|
34
|
+
color: _renderUi.color.text()
|
|
35
|
+
},
|
|
36
|
+
controls: {
|
|
37
|
+
display: 'flex',
|
|
38
|
+
justifyContent: 'flex-end',
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
top: '28px',
|
|
41
|
+
right: '8px',
|
|
42
|
+
cursor: 'pointer'
|
|
43
|
+
},
|
|
44
|
+
dragHandle: {
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
top: '80px',
|
|
47
|
+
left: "-".concat(_common.DragHandleSpace, "px"),
|
|
48
|
+
cursor: 'move'
|
|
49
|
+
},
|
|
50
|
+
removeLabel: {
|
|
51
|
+
display: 'flex',
|
|
52
|
+
whiteSpace: 'break-spaces'
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var TraitTile = /*#__PURE__*/function (_React$Component) {
|
|
56
|
+
(0, _inherits2["default"])(TraitTile, _React$Component);
|
|
57
|
+
var _super = _createSuper(TraitTile);
|
|
58
|
+
function TraitTile() {
|
|
59
|
+
var _this;
|
|
60
|
+
(0, _classCallCheck2["default"])(this, TraitTile);
|
|
61
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
62
|
+
args[_key] = arguments[_key];
|
|
63
|
+
}
|
|
64
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
65
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {});
|
|
66
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTraitChanged", function (params) {
|
|
67
|
+
var _this$props = _this.props,
|
|
68
|
+
trait = _this$props.trait,
|
|
69
|
+
onTraitChanged = _this$props.onTraitChanged;
|
|
70
|
+
if ((0, _isEmpty["default"])(params)) return;
|
|
71
|
+
Object.keys(params).forEach(function (key) {
|
|
72
|
+
trait[key] = params[key];
|
|
73
|
+
});
|
|
74
|
+
onTraitChanged(trait);
|
|
75
|
+
});
|
|
76
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onScorePointDescriptorChange", function (_ref) {
|
|
77
|
+
var descriptor = _ref.descriptor,
|
|
78
|
+
value = _ref.value;
|
|
79
|
+
var scorePointsDescriptors = _this.props.trait.scorePointsDescriptors;
|
|
80
|
+
if (value < 0 || value >= scorePointsDescriptors.length) return;
|
|
81
|
+
scorePointsDescriptors[value] = descriptor;
|
|
82
|
+
_this.onTraitChanged({
|
|
83
|
+
scorePointsDescriptors: scorePointsDescriptors
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleClick", function (event) {
|
|
87
|
+
return _this.setState({
|
|
88
|
+
anchorEl: event.currentTarget
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleClose", function () {
|
|
92
|
+
return _this.setState({
|
|
93
|
+
anchorEl: null
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "scrollToPosition", function (position) {
|
|
97
|
+
return _this.secondaryBlock.scrollTo({
|
|
98
|
+
left: position
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "openMenu", function () {
|
|
102
|
+
_this.props.onTraitRemoved();
|
|
103
|
+
_this.handleClose();
|
|
104
|
+
});
|
|
105
|
+
return _this;
|
|
106
|
+
}
|
|
107
|
+
(0, _createClass2["default"])(TraitTile, [{
|
|
108
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
109
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
110
|
+
if (nextProps.currentPosition !== this.props.currentPosition || this.secondaryBlock && this.secondaryBlock.scrollLeft !== nextProps.currentPosition) {
|
|
111
|
+
this.scrollToPosition(nextProps.currentPosition);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
key: "render",
|
|
116
|
+
value: function render() {
|
|
117
|
+
var _this2 = this;
|
|
118
|
+
var _this$props2 = this.props,
|
|
119
|
+
classes = _this$props2.classes,
|
|
120
|
+
connectDragSource = _this$props2.connectDragSource,
|
|
121
|
+
connectDropTarget = _this$props2.connectDropTarget,
|
|
122
|
+
connectDragPreview = _this$props2.connectDragPreview,
|
|
123
|
+
_this$props2$trait = _this$props2.trait,
|
|
124
|
+
name = _this$props2$trait.name,
|
|
125
|
+
standards = _this$props2$trait.standards,
|
|
126
|
+
description = _this$props2$trait.description,
|
|
127
|
+
scorePointsDescriptors = _this$props2$trait.scorePointsDescriptors,
|
|
128
|
+
scorePointsValues = _this$props2.scorePointsValues,
|
|
129
|
+
showStandards = _this$props2.showStandards,
|
|
130
|
+
showDescription = _this$props2.showDescription,
|
|
131
|
+
enableDragAndDrop = _this$props2.enableDragAndDrop,
|
|
132
|
+
currentPosition = _this$props2.currentPosition,
|
|
133
|
+
secondaryBlockWidth = _this$props2.secondaryBlockWidth,
|
|
134
|
+
spellCheck = _this$props2.spellCheck,
|
|
135
|
+
uploadSoundSupport = _this$props2.uploadSoundSupport;
|
|
136
|
+
var anchorEl = this.state.anchorEl;
|
|
137
|
+
var pluginProps = {
|
|
138
|
+
image: {
|
|
139
|
+
disabled: true
|
|
140
|
+
},
|
|
141
|
+
math: {
|
|
142
|
+
disabled: true
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
return connectDragPreview(connectDropTarget( /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_common.Row, null, /*#__PURE__*/_react["default"].createElement(_common.PrimaryBlock, null, enableDragAndDrop ? connectDragSource( /*#__PURE__*/_react["default"].createElement("span", {
|
|
146
|
+
className: classes.dragHandle
|
|
147
|
+
}, /*#__PURE__*/_react["default"].createElement(_DragIndicator["default"], {
|
|
148
|
+
className: classes.actions
|
|
149
|
+
}))) : null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
150
|
+
className: classes.controls
|
|
151
|
+
}, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
152
|
+
"aria-label": "more",
|
|
153
|
+
"aria-controls": "long-menu",
|
|
154
|
+
"aria-haspopup": "true",
|
|
155
|
+
onClick: this.handleClick
|
|
156
|
+
}, /*#__PURE__*/_react["default"].createElement(_MoreVert["default"], null)), /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
|
157
|
+
id: "long-menu",
|
|
158
|
+
anchorEl: anchorEl,
|
|
159
|
+
keepMounted: true,
|
|
160
|
+
open: !!anchorEl,
|
|
161
|
+
onClose: this.handleClose
|
|
162
|
+
}, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
163
|
+
onClick: this.openMenu
|
|
164
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
165
|
+
className: classes.removeLabel,
|
|
166
|
+
dangerouslySetInnerHTML: {
|
|
167
|
+
__html: "Remove ".concat(name)
|
|
168
|
+
}
|
|
169
|
+
})))), /*#__PURE__*/_react["default"].createElement(_common.UnderlinedInput, {
|
|
170
|
+
markup: name,
|
|
171
|
+
onChange: function onChange(name) {
|
|
172
|
+
return _this2.onTraitChanged({
|
|
173
|
+
name: name
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
pluginProps: _utils.labelPlugins,
|
|
177
|
+
placeholder: "Enter Trait",
|
|
178
|
+
spellCheck: spellCheck,
|
|
179
|
+
uploadSoundSupport: uploadSoundSupport
|
|
180
|
+
})), /*#__PURE__*/_react["default"].createElement(_common.SecondaryBlock, {
|
|
181
|
+
setRef: function setRef(ref) {
|
|
182
|
+
_this2.secondaryBlock = ref;
|
|
183
|
+
},
|
|
184
|
+
width: "".concat(secondaryBlockWidth, "px")
|
|
185
|
+
}, showStandards && standards && /*#__PURE__*/_react["default"].createElement(_common.Block, null, /*#__PURE__*/_react["default"].createElement(_common.ExpandedInput, {
|
|
186
|
+
placeholder: "Standards",
|
|
187
|
+
markup: standards.join(','),
|
|
188
|
+
onChange: function onChange(standards) {
|
|
189
|
+
return _this2.onTraitChanged({
|
|
190
|
+
standards: standards.split(',')
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
pluginProps: pluginProps,
|
|
194
|
+
spellCheck: spellCheck,
|
|
195
|
+
uploadSoundSupport: uploadSoundSupport
|
|
196
|
+
})), showDescription && /*#__PURE__*/_react["default"].createElement(_common.Block, null, /*#__PURE__*/_react["default"].createElement(_common.ExpandedInput, {
|
|
197
|
+
placeholder: "Description",
|
|
198
|
+
markup: description,
|
|
199
|
+
onChange: function onChange(description) {
|
|
200
|
+
return _this2.onTraitChanged({
|
|
201
|
+
description: description
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
pluginProps: pluginProps,
|
|
205
|
+
spellCheck: spellCheck,
|
|
206
|
+
uploadSoundSupport: uploadSoundSupport
|
|
207
|
+
})), (scorePointsValues || []).map(function (scorePointsValue, index) {
|
|
208
|
+
var adjustedBlockWidth = _common.BlockWidth + 2 * 8; // 8 is padding
|
|
209
|
+
var remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 98;
|
|
210
|
+
var value = scorePointsValues.length - index - 1;
|
|
211
|
+
var scoreDescriptor;
|
|
212
|
+
try {
|
|
213
|
+
scoreDescriptor = scorePointsDescriptors[value] || '';
|
|
214
|
+
} catch (e) {
|
|
215
|
+
scoreDescriptor = '';
|
|
216
|
+
}
|
|
217
|
+
return /*#__PURE__*/_react["default"].createElement(_common.Block, {
|
|
218
|
+
key: "key-key-".concat(index)
|
|
219
|
+
}, /*#__PURE__*/_react["default"].createElement(_common.ExpandedInput, {
|
|
220
|
+
placeholder: "Enter Description Here",
|
|
221
|
+
markup: scoreDescriptor,
|
|
222
|
+
onChange: function onChange(descriptor) {
|
|
223
|
+
return _this2.onScorePointDescriptorChange({
|
|
224
|
+
descriptor: descriptor,
|
|
225
|
+
value: value
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
pluginProps: pluginProps,
|
|
229
|
+
alignToRight: remainingSpace < 296 // 296 is the space required for the toolbar
|
|
230
|
+
,
|
|
231
|
+
spellCheck: spellCheck,
|
|
232
|
+
uploadSoundSupport: uploadSoundSupport
|
|
233
|
+
}));
|
|
234
|
+
}))))));
|
|
235
|
+
}
|
|
236
|
+
}]);
|
|
237
|
+
return TraitTile;
|
|
238
|
+
}(_react["default"].Component);
|
|
239
|
+
exports.TraitTile = TraitTile;
|
|
240
|
+
TraitTile.propTypes = {
|
|
241
|
+
connectDragSource: _propTypes["default"].func.isRequired,
|
|
242
|
+
connectDropTarget: _propTypes["default"].func.isRequired,
|
|
243
|
+
connectDragPreview: _propTypes["default"].func.isRequired,
|
|
244
|
+
classes: _propTypes["default"].object.isRequired,
|
|
245
|
+
isDragging: _propTypes["default"].bool.isRequired,
|
|
246
|
+
id: _propTypes["default"].any,
|
|
247
|
+
isOver: _propTypes["default"].bool,
|
|
248
|
+
index: _propTypes["default"].number,
|
|
249
|
+
onTraitChanged: _propTypes["default"].func.isRequired,
|
|
250
|
+
onTraitRemoved: _propTypes["default"].func.isRequired,
|
|
251
|
+
trait: _propTypes["default"].shape({
|
|
252
|
+
name: _propTypes["default"].string,
|
|
253
|
+
standards: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
254
|
+
scorePointsDescriptors: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
255
|
+
description: _propTypes["default"].string
|
|
256
|
+
}),
|
|
257
|
+
scorePointsValues: _propTypes["default"].arrayOf(_propTypes["default"].number),
|
|
258
|
+
showStandards: _propTypes["default"].bool,
|
|
259
|
+
showDescription: _propTypes["default"].bool,
|
|
260
|
+
enableDragAndDrop: _propTypes["default"].bool,
|
|
261
|
+
currentPosition: _propTypes["default"].number,
|
|
262
|
+
secondaryBlockWidth: _propTypes["default"].number
|
|
263
|
+
};
|
|
264
|
+
var StyledTrait = (0, _styles.withStyles)(styles)(TraitTile);
|
|
265
|
+
exports.StyledTrait = StyledTrait;
|
|
266
|
+
var NAME = 'trait-config';
|
|
267
|
+
var traitSource = {
|
|
268
|
+
beginDrag: function beginDrag(props) {
|
|
269
|
+
return {
|
|
270
|
+
name: props.trait.name,
|
|
271
|
+
index: props.index
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
var StyledSource = (0, _reactDnd.DragSource)(NAME, traitSource, function (connect, monitor) {
|
|
276
|
+
return {
|
|
277
|
+
connectDragSource: connect.dragSource(),
|
|
278
|
+
connectDragPreview: connect.dragPreview(),
|
|
279
|
+
isDragging: monitor.isDragging()
|
|
280
|
+
};
|
|
281
|
+
})(StyledTrait);
|
|
282
|
+
var traitTarget = {
|
|
283
|
+
hover: function hover() {
|
|
284
|
+
log('[hover]');
|
|
285
|
+
},
|
|
286
|
+
drop: function drop(props, monitor) {
|
|
287
|
+
var item = monitor.getItem();
|
|
288
|
+
log('[drop] item: ', item, 'didDrop?', monitor.didDrop());
|
|
289
|
+
props.onTraitDropped(item, props.index);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
var StyledSourceAndTarget = (0, _reactDnd.DropTarget)(NAME, traitTarget, function (connect, monitor) {
|
|
293
|
+
return {
|
|
294
|
+
connectDropTarget: connect.dropTarget(),
|
|
295
|
+
isOver: monitor.isOver()
|
|
296
|
+
};
|
|
297
|
+
})(StyledSource);
|
|
298
|
+
var _default = StyledSourceAndTarget;
|
|
299
|
+
exports["default"] = _default;
|
|
300
|
+
//# sourceMappingURL=trait.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trait.js","names":["_react","_interopRequireDefault","require","_debug","_propTypes","_isEmpty","_reactDnd","_styles","_renderUi","_common","_utils","_IconButton","_MoreVert","_Menu","_MenuItem","_DragIndicator","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","log","debug","styles","actions","color","text","controls","display","justifyContent","position","top","right","cursor","dragHandle","left","concat","DragHandleSpace","removeLabel","whiteSpace","TraitTile","_React$Component","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","_defineProperty2","_assertThisInitialized2","params","_this$props","props","trait","onTraitChanged","isEmpty","Object","keys","forEach","key","_ref","descriptor","value","scorePointsDescriptors","event","setState","anchorEl","currentTarget","secondaryBlock","scrollTo","onTraitRemoved","handleClose","_createClass2","UNSAFE_componentWillReceiveProps","nextProps","currentPosition","scrollLeft","scrollToPosition","render","_this2","_this$props2","classes","connectDragSource","connectDropTarget","connectDragPreview","_this$props2$trait","name","standards","description","scorePointsValues","showStandards","showDescription","enableDragAndDrop","secondaryBlockWidth","spellCheck","uploadSoundSupport","state","pluginProps","image","disabled","math","createElement","Row","PrimaryBlock","className","onClick","handleClick","id","keepMounted","open","onClose","openMenu","dangerouslySetInnerHTML","__html","UnderlinedInput","markup","onChange","labelPlugins","placeholder","SecondaryBlock","setRef","ref","width","Block","ExpandedInput","join","split","map","scorePointsValue","index","adjustedBlockWidth","BlockWidth","remainingSpace","scoreDescriptor","onScorePointDescriptorChange","alignToRight","React","Component","exports","propTypes","PropTypes","func","isRequired","object","isDragging","bool","any","isOver","number","shape","string","arrayOf","StyledTrait","withStyles","NAME","traitSource","beginDrag","StyledSource","DragSource","connect","monitor","dragSource","dragPreview","traitTarget","hover","drop","item","getItem","didDrop","onTraitDropped","StyledSourceAndTarget","DropTarget","dropTarget","_default"],"sources":["../src/trait.jsx"],"sourcesContent":["import React from 'react';\nimport debug from 'debug';\nimport PropTypes from 'prop-types';\nimport isEmpty from 'lodash/isEmpty';\nimport { DragSource, DropTarget } from 'react-dnd';\n\nimport { withStyles } from '@material-ui/core/styles';\nimport { color } from '@pie-lib/render-ui';\n\nimport {\n Block,\n BlockWidth,\n DragHandleSpace,\n ExpandedInput,\n PrimaryBlock,\n Row,\n SecondaryBlock,\n UnderlinedInput,\n} from './common';\nimport { labelPlugins } from './utils';\n\nimport IconButton from '@material-ui/core/IconButton';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport DragIndicatorIcon from '@material-ui/icons/DragIndicator';\n\nconst log = debug('@pie-element:placement-ordering:configure:trait-tile');\n\nconst styles = {\n actions: {\n color: color.text(),\n },\n controls: {\n display: 'flex',\n justifyContent: 'flex-end',\n position: 'absolute',\n top: '28px',\n right: '8px',\n cursor: 'pointer',\n },\n dragHandle: {\n position: 'absolute',\n top: '80px',\n left: `-${DragHandleSpace}px`,\n cursor: 'move',\n },\n removeLabel: {\n display: 'flex',\n whiteSpace: 'break-spaces',\n },\n};\n\nexport class TraitTile extends React.Component {\n state = {};\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (\n nextProps.currentPosition !== this.props.currentPosition ||\n (this.secondaryBlock && this.secondaryBlock.scrollLeft !== nextProps.currentPosition)\n ) {\n this.scrollToPosition(nextProps.currentPosition);\n }\n }\n\n onTraitChanged = (params) => {\n const { trait, onTraitChanged } = this.props;\n\n if (isEmpty(params)) return;\n\n Object.keys(params).forEach((key) => {\n trait[key] = params[key];\n });\n\n onTraitChanged(trait);\n };\n\n onScorePointDescriptorChange = ({ descriptor, value }) => {\n const {\n trait: { scorePointsDescriptors },\n } = this.props;\n\n if (value < 0 || value >= scorePointsDescriptors.length) return;\n\n scorePointsDescriptors[value] = descriptor;\n\n this.onTraitChanged({ scorePointsDescriptors });\n };\n\n handleClick = (event) => this.setState({ anchorEl: event.currentTarget });\n\n handleClose = () => this.setState({ anchorEl: null });\n\n scrollToPosition = (position) => this.secondaryBlock.scrollTo({ left: position });\n\n openMenu = () => {\n this.props.onTraitRemoved();\n this.handleClose();\n };\n\n render() {\n const {\n classes,\n connectDragSource,\n connectDropTarget,\n connectDragPreview,\n trait: { name, standards, description, scorePointsDescriptors },\n scorePointsValues,\n showStandards,\n showDescription,\n enableDragAndDrop,\n currentPosition,\n secondaryBlockWidth,\n spellCheck,\n uploadSoundSupport,\n } = this.props;\n const { anchorEl } = this.state;\n\n const pluginProps = {\n image: { disabled: true },\n math: { disabled: true },\n };\n\n return connectDragPreview(\n connectDropTarget(\n <div>\n <Row>\n <PrimaryBlock>\n {enableDragAndDrop\n ? connectDragSource(\n <span className={classes.dragHandle}>\n <DragIndicatorIcon className={classes.actions} />\n </span>,\n )\n : null}\n <div className={classes.controls}>\n <IconButton aria-label=\"more\" aria-controls=\"long-menu\" aria-haspopup=\"true\" onClick={this.handleClick}>\n <MoreVertIcon />\n </IconButton>\n <Menu id=\"long-menu\" anchorEl={anchorEl} keepMounted open={!!anchorEl} onClose={this.handleClose}>\n <MenuItem onClick={this.openMenu}>\n <div className={classes.removeLabel} dangerouslySetInnerHTML={{ __html: `Remove ${name}` }} />\n </MenuItem>\n </Menu>\n </div>\n\n <UnderlinedInput\n markup={name}\n onChange={(name) => this.onTraitChanged({ name })}\n pluginProps={labelPlugins}\n placeholder=\"Enter Trait\"\n spellCheck={spellCheck}\n uploadSoundSupport={uploadSoundSupport}\n />\n </PrimaryBlock>\n <SecondaryBlock\n setRef={(ref) => {\n this.secondaryBlock = ref;\n }}\n width={`${secondaryBlockWidth}px`}\n >\n {showStandards && standards && (\n <Block>\n <ExpandedInput\n placeholder=\"Standards\"\n markup={standards.join(',')}\n onChange={(standards) => this.onTraitChanged({ standards: standards.split(',') })}\n pluginProps={pluginProps}\n spellCheck={spellCheck}\n uploadSoundSupport={uploadSoundSupport}\n />\n </Block>\n )}\n\n {showDescription && (\n <Block>\n <ExpandedInput\n placeholder=\"Description\"\n markup={description}\n onChange={(description) => this.onTraitChanged({ description })}\n pluginProps={pluginProps}\n spellCheck={spellCheck}\n uploadSoundSupport={uploadSoundSupport}\n />\n </Block>\n )}\n\n {(scorePointsValues || []).map((scorePointsValue, index) => {\n const adjustedBlockWidth = BlockWidth + 2 * 8; // 8 is padding\n const remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 98;\n const value = scorePointsValues.length - index - 1;\n let scoreDescriptor;\n\n try {\n scoreDescriptor = scorePointsDescriptors[value] || '';\n } catch (e) {\n scoreDescriptor = '';\n }\n\n return (\n <Block key={`key-key-${index}`}>\n <ExpandedInput\n placeholder=\"Enter Description Here\"\n markup={scoreDescriptor}\n onChange={(descriptor) => this.onScorePointDescriptorChange({ descriptor, value })}\n pluginProps={pluginProps}\n alignToRight={remainingSpace < 296} // 296 is the space required for the toolbar\n spellCheck={spellCheck}\n uploadSoundSupport={uploadSoundSupport}\n />\n </Block>\n );\n })}\n </SecondaryBlock>\n </Row>\n </div>,\n ),\n );\n }\n}\n\nTraitTile.propTypes = {\n connectDragSource: PropTypes.func.isRequired,\n connectDropTarget: PropTypes.func.isRequired,\n connectDragPreview: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n isDragging: PropTypes.bool.isRequired,\n id: PropTypes.any,\n isOver: PropTypes.bool,\n index: PropTypes.number,\n onTraitChanged: PropTypes.func.isRequired,\n onTraitRemoved: PropTypes.func.isRequired,\n trait: PropTypes.shape({\n name: PropTypes.string,\n standards: PropTypes.arrayOf(PropTypes.string),\n scorePointsDescriptors: PropTypes.arrayOf(PropTypes.string),\n description: PropTypes.string,\n }),\n scorePointsValues: PropTypes.arrayOf(PropTypes.number),\n showStandards: PropTypes.bool,\n showDescription: PropTypes.bool,\n enableDragAndDrop: PropTypes.bool,\n currentPosition: PropTypes.number,\n secondaryBlockWidth: PropTypes.number,\n};\n\nexport const StyledTrait = withStyles(styles)(TraitTile);\n\nconst NAME = 'trait-config';\n\nconst traitSource = {\n beginDrag(props) {\n return {\n name: props.trait.name,\n index: props.index,\n };\n },\n};\n\nconst StyledSource = DragSource(NAME, traitSource, (connect, monitor) => ({\n connectDragSource: connect.dragSource(),\n connectDragPreview: connect.dragPreview(),\n isDragging: monitor.isDragging(),\n}))(StyledTrait);\n\nconst traitTarget = {\n hover() {\n log('[hover]');\n },\n drop(props, monitor) {\n const item = monitor.getItem();\n log('[drop] item: ', item, 'didDrop?', monitor.didDrop());\n\n props.onTraitDropped(item, props.index);\n },\n};\n\nconst StyledSourceAndTarget = DropTarget(NAME, traitTarget, (connect, monitor) => ({\n connectDropTarget: connect.dropTarget(),\n isOver: monitor.isOver(),\n}))(StyledSource);\n\nexport default StyledSourceAndTarget;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,IAAAO,OAAA,GAAAP,OAAA;AAUA,IAAAQ,MAAA,GAAAR,OAAA;AAEA,IAAAS,WAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,SAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,KAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,SAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,cAAA,GAAAd,sBAAA,CAAAC,OAAA;AAAiE,SAAAc,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,aAAAL,OAAA,GAAAM,MAAA,MAAAL,yBAAA,QAAAM,SAAA,OAAAF,gBAAA,mBAAAG,WAAA,EAAAF,MAAA,GAAAG,OAAA,CAAAC,SAAA,CAAAN,KAAA,EAAAO,SAAA,EA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AU,CAAC,CAAC;IACvC7E,kBAAkB,EAAE2E,OAAO,CAACG,WAAW,CAAC,CAAC;IACzClB,UAAU,EAAEgB,OAAO,CAAChB,UAAU,CAAC;EACjC,CAAC;AAAA,CAAC,CAAC,CAACQ,WAAW,CAAC;AAEhB,IAAMW,WAAW,GAAG;EAClBC,KAAK,WAAAA,MAAA,EAAG;IACNlJ,GAAG,CAAC,SAAS,CAAC;EAChB,CAAC;EACDmJ,IAAI,WAAAA,KAACjH,KAAK,EAAE4G,OAAO,EAAE;IACnB,IAAMM,IAAI,GAAGN,OAAO,CAACO,OAAO,CAAC,CAAC;IAC9BrJ,GAAG,CAAC,eAAe,EAAEoJ,IAAI,EAAE,UAAU,EAAEN,OAAO,CAACQ,OAAO,CAAC,CAAC,CAAC;IAEzDpH,KAAK,CAACqH,cAAc,CAACH,IAAI,EAAElH,KAAK,CAAC6E,KAAK,CAAC;EACzC;AACF,CAAC;AAED,IAAMyC,qBAAqB,GAAG,IAAAC,oBAAU,EAACjB,IAAI,EAAES,WAAW,EAAE,UAACJ,OAAO,EAAEC,OAAO;EAAA,OAAM;IACjF7E,iBAAiB,EAAE4E,OAAO,CAACa,UAAU,CAAC,CAAC;IACvCzB,MAAM,EAAEa,OAAO,CAACb,MAAM,CAAC;EACzB,CAAC;AAAA,CAAC,CAAC,CAACU,YAAY,CAAC;AAAC,IAAAgB,QAAA,GAEHH,qBAAqB;AAAAhC,OAAA,cAAAmC,QAAA"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.TraitsHeaderTile = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _react = _interopRequireDefault(require("react"));
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
var _styles = require("@material-ui/core/styles");
|
|
18
|
+
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
19
|
+
var _Menu = _interopRequireDefault(require("@material-ui/core/Menu"));
|
|
20
|
+
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
21
|
+
var _MoreVert = _interopRequireDefault(require("@material-ui/icons/MoreVert"));
|
|
22
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
23
|
+
var _common = require("./common");
|
|
24
|
+
var _utils = require("./utils");
|
|
25
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
26
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
27
|
+
var styles = {
|
|
28
|
+
label: {
|
|
29
|
+
textAlign: 'center',
|
|
30
|
+
width: '140px',
|
|
31
|
+
border: 'none',
|
|
32
|
+
margin: '8px',
|
|
33
|
+
padding: '10px 0',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'space-around'
|
|
37
|
+
},
|
|
38
|
+
greyHeader: {
|
|
39
|
+
background: _renderUi.color.secondaryBackground(),
|
|
40
|
+
borderRadius: '4px',
|
|
41
|
+
position: 'relative'
|
|
42
|
+
},
|
|
43
|
+
primaryBlockGreyHeader: {
|
|
44
|
+
paddingTop: '12px'
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var TraitsHeaderTile = /*#__PURE__*/function (_React$Component) {
|
|
48
|
+
(0, _inherits2["default"])(TraitsHeaderTile, _React$Component);
|
|
49
|
+
var _super = _createSuper(TraitsHeaderTile);
|
|
50
|
+
function TraitsHeaderTile() {
|
|
51
|
+
var _this;
|
|
52
|
+
(0, _classCallCheck2["default"])(this, TraitsHeaderTile);
|
|
53
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
54
|
+
args[_key] = arguments[_key];
|
|
55
|
+
}
|
|
56
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
57
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
58
|
+
anchorEl: null
|
|
59
|
+
});
|
|
60
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onScorePointLabelChange", function (_ref) {
|
|
61
|
+
var scorePointLabel = _ref.scorePointLabel,
|
|
62
|
+
value = _ref.value;
|
|
63
|
+
var _this$props = _this.props,
|
|
64
|
+
scorePointsLabels = _this$props.scorePointsLabels,
|
|
65
|
+
onScaleChange = _this$props.onScaleChange;
|
|
66
|
+
if (value < 0 || value >= scorePointsLabels.length) return;
|
|
67
|
+
scorePointsLabels[value] = scorePointLabel;
|
|
68
|
+
onScaleChange({
|
|
69
|
+
scorePointsLabels: scorePointsLabels
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleClick", function (event) {
|
|
73
|
+
return _this.setState({
|
|
74
|
+
anchorEl: event.currentTarget
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleClose", function () {
|
|
78
|
+
return _this.setState({
|
|
79
|
+
anchorEl: null
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "scrollToPosition", function (position) {
|
|
83
|
+
return _this.secondaryBlock.scrollTo({
|
|
84
|
+
left: position
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "openMenu", function () {
|
|
88
|
+
_this.props.showDeleteScaleModal();
|
|
89
|
+
_this.handleClose();
|
|
90
|
+
});
|
|
91
|
+
return _this;
|
|
92
|
+
}
|
|
93
|
+
(0, _createClass2["default"])(TraitsHeaderTile, [{
|
|
94
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
95
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
96
|
+
if (nextProps.currentPosition !== this.props.currentPosition) {
|
|
97
|
+
this.scrollToPosition(nextProps.currentPosition);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "render",
|
|
102
|
+
value: function render() {
|
|
103
|
+
var _this2 = this;
|
|
104
|
+
var _this$props2 = this.props,
|
|
105
|
+
scorePointsValues = _this$props2.scorePointsValues,
|
|
106
|
+
scorePointsLabels = _this$props2.scorePointsLabels,
|
|
107
|
+
traitLabel = _this$props2.traitLabel,
|
|
108
|
+
classes = _this$props2.classes,
|
|
109
|
+
currentPosition = _this$props2.currentPosition,
|
|
110
|
+
showStandards = _this$props2.showStandards,
|
|
111
|
+
onTraitLabelChange = _this$props2.onTraitLabelChange,
|
|
112
|
+
showDescription = _this$props2.showDescription,
|
|
113
|
+
showLevelTagInput = _this$props2.showLevelTagInput,
|
|
114
|
+
maxPoints = _this$props2.maxPoints,
|
|
115
|
+
updateMaxPointsFieldValue = _this$props2.updateMaxPointsFieldValue,
|
|
116
|
+
scaleIndex = _this$props2.scaleIndex,
|
|
117
|
+
showScorePointLabels = _this$props2.showScorePointLabels,
|
|
118
|
+
secondaryBlockWidth = _this$props2.secondaryBlockWidth,
|
|
119
|
+
setSecondaryBlockRef = _this$props2.setSecondaryBlockRef,
|
|
120
|
+
spellCheck = _this$props2.spellCheck,
|
|
121
|
+
uploadSoundSupport = _this$props2.uploadSoundSupport,
|
|
122
|
+
maxPointsEnabled = _this$props2.maxPointsEnabled;
|
|
123
|
+
var anchorEl = this.state.anchorEl;
|
|
124
|
+
return /*#__PURE__*/_react["default"].createElement(_common.Row, {
|
|
125
|
+
className: classes.greyHeader,
|
|
126
|
+
height: showLevelTagInput ? _common.HeaderHeightLarge : _common.HeaderHeight
|
|
127
|
+
}, /*#__PURE__*/_react["default"].createElement(_common.PrimaryBlock, {
|
|
128
|
+
className: classes.primaryBlockGreyHeader
|
|
129
|
+
}, showLevelTagInput && /*#__PURE__*/_react["default"].createElement(_common.SimpleInput, {
|
|
130
|
+
markup: traitLabel || 'Trait',
|
|
131
|
+
onChange: onTraitLabelChange,
|
|
132
|
+
pluginProps: _utils.labelPlugins,
|
|
133
|
+
spellCheck: spellCheck,
|
|
134
|
+
label: "Level Label",
|
|
135
|
+
uploadSoundSupport: uploadSoundSupport
|
|
136
|
+
}), /*#__PURE__*/_react["default"].createElement(_common.ScaleSettings, null, /*#__PURE__*/_react["default"].createElement("div", null, "Scale ", scaleIndex + 1), maxPointsEnabled && /*#__PURE__*/_react["default"].createElement(_common.MaxPointsPicker, {
|
|
137
|
+
maxPoints: maxPoints,
|
|
138
|
+
onChange: updateMaxPointsFieldValue
|
|
139
|
+
}), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
140
|
+
"aria-label": "more",
|
|
141
|
+
"aria-controls": "long-menu",
|
|
142
|
+
"aria-haspopup": "true",
|
|
143
|
+
onClick: this.handleClick
|
|
144
|
+
}, /*#__PURE__*/_react["default"].createElement(_MoreVert["default"], null)), /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
|
145
|
+
id: "long-menu",
|
|
146
|
+
anchorEl: anchorEl,
|
|
147
|
+
keepMounted: true,
|
|
148
|
+
open: !!anchorEl,
|
|
149
|
+
onClose: this.handleClose
|
|
150
|
+
}, ['Remove Scale'].map(function (option) {
|
|
151
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
152
|
+
key: option,
|
|
153
|
+
onClick: _this2.openMenu
|
|
154
|
+
}, option);
|
|
155
|
+
}))))), /*#__PURE__*/_react["default"].createElement(_common.SecondaryBlock, {
|
|
156
|
+
setRef: function setRef(ref) {
|
|
157
|
+
if (ref) {
|
|
158
|
+
_this2.secondaryBlock = ref;
|
|
159
|
+
setSecondaryBlockRef(ref);
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
width: "".concat(secondaryBlockWidth, "px")
|
|
163
|
+
}, showStandards && /*#__PURE__*/_react["default"].createElement(_common.Block, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
164
|
+
className: classes.label
|
|
165
|
+
}, "Standard(s)")), showDescription && /*#__PURE__*/_react["default"].createElement(_common.Block, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
166
|
+
className: classes.label
|
|
167
|
+
}, "Description")), scorePointsValues.map(function (scorePointsValue, index) {
|
|
168
|
+
var adjustedBlockWidth = _common.BlockWidth + 2 * 8; // 8 is padding
|
|
169
|
+
var remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 128;
|
|
170
|
+
var value = scorePointsValues.length - index - 1;
|
|
171
|
+
var scoreDescriptor;
|
|
172
|
+
try {
|
|
173
|
+
scoreDescriptor = scorePointsLabels[value] || '';
|
|
174
|
+
} catch (e) {
|
|
175
|
+
scoreDescriptor = '';
|
|
176
|
+
}
|
|
177
|
+
return /*#__PURE__*/_react["default"].createElement(_common.Block, {
|
|
178
|
+
key: "secondary-block-part-".concat(index)
|
|
179
|
+
}, /*#__PURE__*/_react["default"].createElement(_common.ScorePoint, {
|
|
180
|
+
scorePointsValue: scorePointsValue,
|
|
181
|
+
scoreDescriptor: scoreDescriptor,
|
|
182
|
+
pluginProps: _utils.labelPlugins,
|
|
183
|
+
showScorePointLabels: showScorePointLabels,
|
|
184
|
+
onChange: function onChange(scorePointLabel) {
|
|
185
|
+
return _this2.onScorePointLabelChange({
|
|
186
|
+
scorePointLabel: scorePointLabel,
|
|
187
|
+
value: value
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
alignToRight: remainingSpace < 296 // 296 is the space required for the toolbar
|
|
191
|
+
,
|
|
192
|
+
spellCheck: spellCheck,
|
|
193
|
+
uploadSoundSupport: uploadSoundSupport
|
|
194
|
+
}));
|
|
195
|
+
})));
|
|
196
|
+
}
|
|
197
|
+
}]);
|
|
198
|
+
return TraitsHeaderTile;
|
|
199
|
+
}(_react["default"].Component);
|
|
200
|
+
exports.TraitsHeaderTile = TraitsHeaderTile;
|
|
201
|
+
TraitsHeaderTile.propTypes = {
|
|
202
|
+
classes: _propTypes["default"].object.isRequired,
|
|
203
|
+
onTraitLabelChange: _propTypes["default"].func,
|
|
204
|
+
onScaleChange: _propTypes["default"].func,
|
|
205
|
+
scorePointsValues: _propTypes["default"].arrayOf(_propTypes["default"].number),
|
|
206
|
+
scorePointsLabels: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
207
|
+
traitLabel: _propTypes["default"].string,
|
|
208
|
+
showStandards: _propTypes["default"].bool,
|
|
209
|
+
showLevelTagInput: _propTypes["default"].bool,
|
|
210
|
+
showDescription: _propTypes["default"].bool,
|
|
211
|
+
maxPoints: _propTypes["default"].number,
|
|
212
|
+
updateMaxPointsFieldValue: _propTypes["default"].func,
|
|
213
|
+
scaleIndex: _propTypes["default"].number,
|
|
214
|
+
currentPosition: _propTypes["default"].number,
|
|
215
|
+
secondaryBlockWidth: _propTypes["default"].number,
|
|
216
|
+
showDeleteScaleModal: _propTypes["default"].func,
|
|
217
|
+
showScorePointLabels: _propTypes["default"].bool,
|
|
218
|
+
setSecondaryBlockRef: _propTypes["default"].func,
|
|
219
|
+
uploadSoundSupport: _propTypes["default"].object
|
|
220
|
+
};
|
|
221
|
+
var _default = (0, _styles.withStyles)(styles)(TraitsHeaderTile);
|
|
222
|
+
exports["default"] = _default;
|
|
223
|
+
//# sourceMappingURL=traitsHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traitsHeader.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_IconButton","_Menu","_MenuItem","_MoreVert","_renderUi","_common","_utils","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","label","textAlign","width","border","margin","padding","display","alignItems","justifyContent","greyHeader","background","color","secondaryBackground","borderRadius","position","primaryBlockGreyHeader","paddingTop","TraitsHeaderTile","_React$Component","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","anchorEl","_ref","scorePointLabel","value","_this$props","props","scorePointsLabels","onScaleChange","event","setState","currentTarget","secondaryBlock","scrollTo","left","showDeleteScaleModal","handleClose","_createClass2","key","UNSAFE_componentWillReceiveProps","nextProps","currentPosition","scrollToPosition","render","_this2","_this$props2","scorePointsValues","traitLabel","classes","showStandards","onTraitLabelChange","showDescription","showLevelTagInput","maxPoints","updateMaxPointsFieldValue","scaleIndex","showScorePointLabels","secondaryBlockWidth","setSecondaryBlockRef","spellCheck","uploadSoundSupport","maxPointsEnabled","state","createElement","Row","className","height","HeaderHeightLarge","HeaderHeight","PrimaryBlock","SimpleInput","markup","onChange","pluginProps","labelPlugins","ScaleSettings","MaxPointsPicker","onClick","handleClick","id","keepMounted","open","onClose","map","option","openMenu","SecondaryBlock","setRef","ref","Block","scorePointsValue","index","adjustedBlockWidth","BlockWidth","remainingSpace","scoreDescriptor","ScorePoint","onScorePointLabelChange","alignToRight","React","Component","exports","propTypes","PropTypes","object","isRequired","func","arrayOf","number","string","bool","_default","withStyles"],"sources":["../src/traitsHeader.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { withStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport { color } from '@pie-lib/render-ui';\n\nimport {\n Block,\n BlockWidth,\n PrimaryBlock,\n Row,\n SecondaryBlock,\n ScorePoint,\n MaxPointsPicker,\n SimpleInput,\n ScaleSettings,\n HeaderHeight,\n HeaderHeightLarge,\n} from './common';\nimport { labelPlugins } from './utils';\n\nconst styles = {\n label: {\n textAlign: 'center',\n width: '140px',\n border: 'none',\n margin: '8px',\n padding: '10px 0',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-around',\n },\n greyHeader: {\n background: color.secondaryBackground(),\n borderRadius: '4px',\n position: 'relative',\n },\n primaryBlockGreyHeader: {\n paddingTop: '12px',\n },\n};\n\nexport class TraitsHeaderTile extends React.Component {\n state = {\n anchorEl: null,\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (nextProps.currentPosition !== this.props.currentPosition) {\n this.scrollToPosition(nextProps.currentPosition);\n }\n }\n\n onScorePointLabelChange = ({ scorePointLabel, value }) => {\n const { scorePointsLabels, onScaleChange } = this.props;\n\n if (value < 0 || value >= scorePointsLabels.length) return;\n\n scorePointsLabels[value] = scorePointLabel;\n\n onScaleChange({ scorePointsLabels });\n };\n\n handleClick = (event) => this.setState({ anchorEl: event.currentTarget });\n\n handleClose = () => this.setState({ anchorEl: null });\n\n scrollToPosition = (position) => this.secondaryBlock.scrollTo({ left: position });\n\n openMenu = () => {\n this.props.showDeleteScaleModal();\n this.handleClose();\n };\n\n render() {\n const {\n scorePointsValues,\n scorePointsLabels,\n traitLabel,\n classes,\n currentPosition,\n showStandards,\n onTraitLabelChange,\n showDescription,\n showLevelTagInput,\n maxPoints,\n updateMaxPointsFieldValue,\n scaleIndex,\n showScorePointLabels,\n secondaryBlockWidth,\n setSecondaryBlockRef,\n spellCheck,\n uploadSoundSupport,\n maxPointsEnabled,\n } = this.props;\n const { anchorEl } = this.state;\n\n return (\n <Row className={classes.greyHeader} height={showLevelTagInput ? HeaderHeightLarge : HeaderHeight}>\n <PrimaryBlock className={classes.primaryBlockGreyHeader}>\n {showLevelTagInput && (\n <SimpleInput\n markup={traitLabel || 'Trait'}\n onChange={onTraitLabelChange}\n pluginProps={labelPlugins}\n spellCheck={spellCheck}\n label=\"Level Label\"\n uploadSoundSupport={uploadSoundSupport}\n />\n )}\n\n <ScaleSettings>\n <div>Scale {scaleIndex + 1}</div>\n\n {maxPointsEnabled && <MaxPointsPicker maxPoints={maxPoints} onChange={updateMaxPointsFieldValue} />}\n\n <div>\n <IconButton aria-label=\"more\" aria-controls=\"long-menu\" aria-haspopup=\"true\" onClick={this.handleClick}>\n <MoreVertIcon />\n </IconButton>\n <Menu id=\"long-menu\" anchorEl={anchorEl} keepMounted open={!!anchorEl} onClose={this.handleClose}>\n {['Remove Scale'].map((option) => (\n <MenuItem key={option} onClick={this.openMenu}>\n {option}\n </MenuItem>\n ))}\n </Menu>\n </div>\n </ScaleSettings>\n </PrimaryBlock>\n\n <SecondaryBlock\n setRef={(ref) => {\n if (ref) {\n this.secondaryBlock = ref;\n setSecondaryBlockRef(ref);\n }\n }}\n width={`${secondaryBlockWidth}px`}\n >\n {showStandards && (\n <Block>\n <div className={classes.label}>Standard(s)</div>\n </Block>\n )}\n\n {showDescription && (\n <Block>\n <div className={classes.label}>Description</div>\n </Block>\n )}\n\n {scorePointsValues.map((scorePointsValue, index) => {\n const adjustedBlockWidth = BlockWidth + 2 * 8; // 8 is padding\n const remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 128;\n const value = scorePointsValues.length - index - 1;\n let scoreDescriptor;\n\n try {\n scoreDescriptor = scorePointsLabels[value] || '';\n } catch (e) {\n scoreDescriptor = '';\n }\n\n return (\n <Block key={`secondary-block-part-${index}`}>\n <ScorePoint\n scorePointsValue={scorePointsValue}\n scoreDescriptor={scoreDescriptor}\n pluginProps={labelPlugins}\n showScorePointLabels={showScorePointLabels}\n onChange={(scorePointLabel) => this.onScorePointLabelChange({ scorePointLabel, value })}\n alignToRight={remainingSpace < 296} // 296 is the space required for the toolbar\n spellCheck={spellCheck}\n uploadSoundSupport={uploadSoundSupport}\n />\n </Block>\n );\n })}\n </SecondaryBlock>\n </Row>\n );\n }\n}\n\nTraitsHeaderTile.propTypes = {\n classes: PropTypes.object.isRequired,\n onTraitLabelChange: PropTypes.func,\n onScaleChange: PropTypes.func,\n scorePointsValues: PropTypes.arrayOf(PropTypes.number),\n scorePointsLabels: PropTypes.arrayOf(PropTypes.string),\n traitLabel: PropTypes.string,\n showStandards: PropTypes.bool,\n showLevelTagInput: PropTypes.bool,\n showDescription: PropTypes.bool,\n maxPoints: PropTypes.number,\n updateMaxPointsFieldValue: PropTypes.func,\n scaleIndex: PropTypes.number,\n currentPosition: PropTypes.number,\n secondaryBlockWidth: PropTypes.number,\n showDeleteScaleModal: PropTypes.func,\n showScorePointLabels: PropTypes.bool,\n setSecondaryBlockRef: PropTypes.func,\n uploadSoundSupport: PropTypes.object,\n};\n\nexport default withStyles(styles)(TraitsHeaderTile);\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA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+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.labelPlugins = exports.filteredDefaultPlugins = void 0;
|
|
7
|
+
var _editableHtml = require("@pie-lib/editable-html");
|
|
8
|
+
var filteredDefaultPlugins = (_editableHtml.DEFAULT_PLUGINS || []).filter(function (p) {
|
|
9
|
+
return p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list';
|
|
10
|
+
});
|
|
11
|
+
exports.filteredDefaultPlugins = filteredDefaultPlugins;
|
|
12
|
+
var labelPlugins = {
|
|
13
|
+
image: {
|
|
14
|
+
disabled: true
|
|
15
|
+
},
|
|
16
|
+
math: {
|
|
17
|
+
disabled: true
|
|
18
|
+
},
|
|
19
|
+
audio: {
|
|
20
|
+
disabled: true
|
|
21
|
+
},
|
|
22
|
+
video: {
|
|
23
|
+
disabled: true
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.labelPlugins = labelPlugins;
|
|
27
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_editableHtml","require","filteredDefaultPlugins","DEFAULT_PLUGINS","filter","p","exports","labelPlugins","image","disabled","math","audio","video"],"sources":["../src/utils.js"],"sourcesContent":["import { DEFAULT_PLUGINS } from '@pie-lib/editable-html';\n\nexport const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(\n (p) => p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list',\n);\n\nexport const labelPlugins = {\n image: { disabled: true },\n math: { disabled: true },\n audio: { disabled: true },\n video: { disabled: true },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEO,IAAMC,sBAAsB,GAAG,CAACC,6BAAe,IAAI,EAAE,EAAEC,MAAM,CAClE,UAACC,CAAC;EAAA,OAAKA,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,eAAe,IAAIA,CAAC,KAAK,eAAe;AAAA,CACxE,CAAC;AAACC,OAAA,CAAAJ,sBAAA,GAAAA,sBAAA;AAEK,IAAMK,YAAY,GAAG;EAC1BC,KAAK,EAAE;IAAEC,QAAQ,EAAE;EAAK,CAAC;EACzBC,IAAI,EAAE;IAAED,QAAQ,EAAE;EAAK,CAAC;EACxBE,KAAK,EAAE;IAAEF,QAAQ,EAAE;EAAK,CAAC;EACzBG,KAAK,EAAE;IAAEH,QAAQ,EAAE;EAAK;AAC1B,CAAC;AAACH,OAAA,CAAAC,YAAA,GAAAA,YAAA"}
|