@pie-element/multi-trait-rubric 1.3.0 → 1.3.1-beta.587
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +466 -0
- package/configure/CHANGELOG.md +415 -0
- package/configure/lib/common.js +81 -16
- package/configure/lib/common.js.map +1 -1
- package/configure/lib/defaults.js +40 -4
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +18 -4
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +166 -97
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/modals.js +71 -12
- package/configure/lib/modals.js.map +1 -1
- package/configure/lib/scale.js +69 -15
- package/configure/lib/scale.js.map +1 -1
- package/configure/lib/trait.js +50 -21
- package/configure/lib/trait.js.map +1 -1
- package/configure/lib/traitsHeader.js +28 -17
- package/configure/lib/traitsHeader.js.map +1 -1
- package/configure/lib/utils.js +29 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +7 -7
- package/controller/CHANGELOG.md +57 -0
- package/controller/lib/defaults.js +85 -1
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +5 -3
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +2 -2
- package/docs/config-schema.json +129 -0
- package/docs/config-schema.json.md +96 -0
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +92 -20
- package/docs/demo/session.js +1 -1
- package/docs/pie-schema.json +23 -1
- package/docs/pie-schema.json.md +16 -0
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/main.js +42 -7
- package/lib/main.js.map +1 -1
- package/lib/scale.js +5 -1
- package/lib/scale.js.map +1 -1
- package/lib/trait.js.map +1 -1
- package/package.json +4 -3
package/configure/lib/trait.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.
|
|
8
|
+
exports["default"] = exports.TraitTile = exports.StyledTrait = void 0;
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
@@ -37,6 +37,8 @@ var _renderUi = require("@pie-lib/render-ui");
|
|
|
37
37
|
|
|
38
38
|
var _common = require("./common");
|
|
39
39
|
|
|
40
|
+
var _utils = require("./utils");
|
|
41
|
+
|
|
40
42
|
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
41
43
|
|
|
42
44
|
var _MoreVert = _interopRequireDefault(require("@material-ui/icons/MoreVert"));
|
|
@@ -49,12 +51,12 @@ var _DragIndicator = _interopRequireDefault(require("@material-ui/icons/DragIndi
|
|
|
49
51
|
|
|
50
52
|
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); }; }
|
|
51
53
|
|
|
52
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
54
|
+
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; } }
|
|
53
55
|
|
|
54
56
|
var log = (0, _debug["default"])('@pie-element:placement-ordering:configure:trait-tile');
|
|
55
57
|
var styles = {
|
|
56
58
|
actions: {
|
|
57
|
-
color: _renderUi.color.
|
|
59
|
+
color: _renderUi.color.text()
|
|
58
60
|
},
|
|
59
61
|
controls: {
|
|
60
62
|
display: 'flex',
|
|
@@ -69,6 +71,10 @@ var styles = {
|
|
|
69
71
|
top: '80px',
|
|
70
72
|
left: "-".concat(_common.DragHandleSpace, "px"),
|
|
71
73
|
cursor: 'move'
|
|
74
|
+
},
|
|
75
|
+
removeLabel: {
|
|
76
|
+
display: 'flex',
|
|
77
|
+
whiteSpace: 'break-spaces'
|
|
72
78
|
}
|
|
73
79
|
};
|
|
74
80
|
|
|
@@ -148,6 +154,7 @@ var TraitTile = /*#__PURE__*/function (_React$Component) {
|
|
|
148
154
|
classes = _this$props2.classes,
|
|
149
155
|
connectDragSource = _this$props2.connectDragSource,
|
|
150
156
|
connectDropTarget = _this$props2.connectDropTarget,
|
|
157
|
+
connectDragPreview = _this$props2.connectDragPreview,
|
|
151
158
|
_this$props2$trait = _this$props2.trait,
|
|
152
159
|
name = _this$props2$trait.name,
|
|
153
160
|
standards = _this$props2$trait.standards,
|
|
@@ -156,9 +163,12 @@ var TraitTile = /*#__PURE__*/function (_React$Component) {
|
|
|
156
163
|
scorePointsValues = _this$props2.scorePointsValues,
|
|
157
164
|
showStandards = _this$props2.showStandards,
|
|
158
165
|
showDescription = _this$props2.showDescription,
|
|
159
|
-
enableDragAndDrop = _this$props2.enableDragAndDrop
|
|
166
|
+
enableDragAndDrop = _this$props2.enableDragAndDrop,
|
|
167
|
+
currentPosition = _this$props2.currentPosition,
|
|
168
|
+
secondaryBlockWidth = _this$props2.secondaryBlockWidth,
|
|
169
|
+
spellCheck = _this$props2.spellCheck,
|
|
170
|
+
uploadSoundSupport = _this$props2.uploadSoundSupport;
|
|
160
171
|
var anchorEl = this.state.anchorEl;
|
|
161
|
-
var dragSourceOpts = {};
|
|
162
172
|
var pluginProps = {
|
|
163
173
|
image: {
|
|
164
174
|
disabled: true
|
|
@@ -167,11 +177,11 @@ var TraitTile = /*#__PURE__*/function (_React$Component) {
|
|
|
167
177
|
disabled: true
|
|
168
178
|
}
|
|
169
179
|
};
|
|
170
|
-
return
|
|
180
|
+
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", {
|
|
171
181
|
className: classes.dragHandle
|
|
172
182
|
}, /*#__PURE__*/_react["default"].createElement(_DragIndicator["default"], {
|
|
173
183
|
className: classes.actions
|
|
174
|
-
})) : null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
184
|
+
}))) : null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
175
185
|
className: classes.controls
|
|
176
186
|
}, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
177
187
|
"aria-label": "more",
|
|
@@ -184,24 +194,29 @@ var TraitTile = /*#__PURE__*/function (_React$Component) {
|
|
|
184
194
|
keepMounted: true,
|
|
185
195
|
open: !!anchorEl,
|
|
186
196
|
onClose: this.handleClose
|
|
187
|
-
}, [
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
}, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
198
|
+
onClick: this.openMenu
|
|
199
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
200
|
+
className: classes.removeLabel,
|
|
201
|
+
dangerouslySetInnerHTML: {
|
|
202
|
+
__html: "Remove ".concat(name)
|
|
203
|
+
}
|
|
204
|
+
})))), /*#__PURE__*/_react["default"].createElement(_common.UnderlinedInput, {
|
|
193
205
|
markup: name,
|
|
194
206
|
onChange: function onChange(name) {
|
|
195
207
|
return _this2.onTraitChanged({
|
|
196
208
|
name: name
|
|
197
209
|
});
|
|
198
210
|
},
|
|
199
|
-
pluginProps:
|
|
200
|
-
placeholder: "Enter Trait"
|
|
211
|
+
pluginProps: _utils.labelPlugins,
|
|
212
|
+
placeholder: "Enter Trait",
|
|
213
|
+
spellCheck: spellCheck,
|
|
214
|
+
uploadSoundSupport: uploadSoundSupport
|
|
201
215
|
})), /*#__PURE__*/_react["default"].createElement(_common.SecondaryBlock, {
|
|
202
216
|
setRef: function setRef(ref) {
|
|
203
217
|
_this2.secondaryBlock = ref;
|
|
204
|
-
}
|
|
218
|
+
},
|
|
219
|
+
width: "".concat(secondaryBlockWidth, "px")
|
|
205
220
|
}, showStandards && standards && /*#__PURE__*/_react["default"].createElement(_common.Block, null, /*#__PURE__*/_react["default"].createElement(_common.ExpandedInput, {
|
|
206
221
|
placeholder: "Standards",
|
|
207
222
|
markup: standards.join(','),
|
|
@@ -210,7 +225,9 @@ var TraitTile = /*#__PURE__*/function (_React$Component) {
|
|
|
210
225
|
standards: standards.split(',')
|
|
211
226
|
});
|
|
212
227
|
},
|
|
213
|
-
pluginProps: pluginProps
|
|
228
|
+
pluginProps: pluginProps,
|
|
229
|
+
spellCheck: spellCheck,
|
|
230
|
+
uploadSoundSupport: uploadSoundSupport
|
|
214
231
|
})), showDescription && /*#__PURE__*/_react["default"].createElement(_common.Block, null, /*#__PURE__*/_react["default"].createElement(_common.ExpandedInput, {
|
|
215
232
|
placeholder: "Description",
|
|
216
233
|
markup: description,
|
|
@@ -219,8 +236,13 @@ var TraitTile = /*#__PURE__*/function (_React$Component) {
|
|
|
219
236
|
description: description
|
|
220
237
|
});
|
|
221
238
|
},
|
|
222
|
-
pluginProps: pluginProps
|
|
239
|
+
pluginProps: pluginProps,
|
|
240
|
+
spellCheck: spellCheck,
|
|
241
|
+
uploadSoundSupport: uploadSoundSupport
|
|
223
242
|
})), (scorePointsValues || []).map(function (scorePointsValue, index) {
|
|
243
|
+
var adjustedBlockWidth = _common.BlockWidth + 2 * 8; // 8 is padding
|
|
244
|
+
|
|
245
|
+
var remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 98;
|
|
224
246
|
var value = scorePointsValues.length - index - 1;
|
|
225
247
|
var scoreDescriptor;
|
|
226
248
|
|
|
@@ -241,9 +263,13 @@ var TraitTile = /*#__PURE__*/function (_React$Component) {
|
|
|
241
263
|
value: value
|
|
242
264
|
});
|
|
243
265
|
},
|
|
244
|
-
pluginProps: pluginProps
|
|
266
|
+
pluginProps: pluginProps,
|
|
267
|
+
alignToRight: remainingSpace < 296 // 296 is the space required for the toolbar
|
|
268
|
+
,
|
|
269
|
+
spellCheck: spellCheck,
|
|
270
|
+
uploadSoundSupport: uploadSoundSupport
|
|
245
271
|
}));
|
|
246
|
-
})))))
|
|
272
|
+
}))))));
|
|
247
273
|
}
|
|
248
274
|
}]);
|
|
249
275
|
return TraitTile;
|
|
@@ -253,6 +279,7 @@ exports.TraitTile = TraitTile;
|
|
|
253
279
|
TraitTile.propTypes = {
|
|
254
280
|
connectDragSource: _propTypes["default"].func.isRequired,
|
|
255
281
|
connectDropTarget: _propTypes["default"].func.isRequired,
|
|
282
|
+
connectDragPreview: _propTypes["default"].func.isRequired,
|
|
256
283
|
classes: _propTypes["default"].object.isRequired,
|
|
257
284
|
isDragging: _propTypes["default"].bool.isRequired,
|
|
258
285
|
id: _propTypes["default"].any,
|
|
@@ -270,7 +297,8 @@ TraitTile.propTypes = {
|
|
|
270
297
|
showStandards: _propTypes["default"].bool,
|
|
271
298
|
showDescription: _propTypes["default"].bool,
|
|
272
299
|
enableDragAndDrop: _propTypes["default"].bool,
|
|
273
|
-
currentPosition: _propTypes["default"].number
|
|
300
|
+
currentPosition: _propTypes["default"].number,
|
|
301
|
+
secondaryBlockWidth: _propTypes["default"].number
|
|
274
302
|
};
|
|
275
303
|
var StyledTrait = (0, _styles.withStyles)(styles)(TraitTile);
|
|
276
304
|
exports.StyledTrait = StyledTrait;
|
|
@@ -286,6 +314,7 @@ var traitSource = {
|
|
|
286
314
|
var StyledSource = (0, _reactDnd.DragSource)(NAME, traitSource, function (connect, monitor) {
|
|
287
315
|
return {
|
|
288
316
|
connectDragSource: connect.dragSource(),
|
|
317
|
+
connectDragPreview: connect.dragPreview(),
|
|
289
318
|
isDragging: monitor.isDragging()
|
|
290
319
|
};
|
|
291
320
|
})(StyledTrait);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/trait.jsx"],"names":["log","styles","actions","color","secondaryBackground","controls","display","justifyContent","position","top","right","cursor","dragHandle","left","DragHandleSpace","TraitTile","params","props","trait","onTraitChanged","Object","keys","forEach","key","descriptor","value","scorePointsDescriptors","length","event","setState","anchorEl","currentTarget","secondaryBlock","scrollTo","onTraitRemoved","handleClose","nextProps","currentPosition","scrollLeft","scrollToPosition","classes","connectDragSource","connectDropTarget","name","standards","description","scorePointsValues","showStandards","showDescription","enableDragAndDrop","state","dragSourceOpts","pluginProps","image","disabled","math","handleClick","map","option","openMenu","ref","join","split","scorePointsValue","index","scoreDescriptor","e","onScorePointDescriptorChange","React","Component","propTypes","PropTypes","func","isRequired","object","isDragging","bool","id","any","isOver","number","shape","string","arrayOf","StyledTrait","NAME","traitSource","beginDrag","StyledSource","connect","monitor","dragSource","traitTarget","hover","drop","item","getItem","didDrop","onTraitDropped","StyledSourceAndTarget","dropTarget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AASA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,sDAAN,CAAZ;AAEA,IAAMC,MAAM,GAAG;AACbC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAEA,gBAAMC,mBAAN;AADA,GADI;AAIbC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,OAAO,EAAE,MADD;AAERC,IAAAA,cAAc,EAAE,UAFR;AAGRC,IAAAA,QAAQ,EAAE,UAHF;AAIRC,IAAAA,GAAG,EAAE,MAJG;AAKRC,IAAAA,KAAK,EAAE,KALC;AAMRC,IAAAA,MAAM,EAAE;AANA,GAJG;AAYbC,EAAAA,UAAU,EAAE;AACVJ,IAAAA,QAAQ,EAAE,UADA;AAEVC,IAAAA,GAAG,EAAE,MA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Ab;AAEA,IAAMC,WAAW,GAAG;AAClBC,EAAAA,SADkB,qBACRtE,KADQ,EACD;AACf,WAAO;AACL0B,MAAAA,IAAI,EAAE1B,KAAK,CAACC,KAAN,CAAYyB,IADb;AAELqB,MAAAA,KAAK,EAAE/C,KAAK,CAAC+C;AAFR,KAAP;AAID;AANiB,CAApB;AASA,IAAMwB,YAAY,GAAG,0BACnBH,IADmB,EAEnBC,WAFmB,EAGnB,UAACG,OAAD,EAAUC,OAAV;AAAA,SAAuB;AACrBjD,IAAAA,iBAAiB,EAAEgD,OAAO,CAACE,UAAR,EADE;AAErBhB,IAAAA,UAAU,EAAEe,OAAO,CAACf,UAAR;AAFS,GAAvB;AAAA,CAHmB,EAOnBS,WAPmB,CAArB;AASA,IAAMQ,WAAW,GAAG;AAClBC,EAAAA,KADkB,mBACV;AACN7F,IAAAA,GAAG,CAAC,SAAD,CAAH;AACD,GAHiB;AAIlB8F,EAAAA,IAJkB,gBAIb7E,KAJa,EAINyE,OAJM,EAIG;AACnB,QAAMK,IAAI,GAAGL,OAAO,CAACM,OAAR,EAAb;AACAhG,IAAAA,GAAG,CAAC,eAAD,EAAkB+F,IAAlB,EAAwB,UAAxB,EAAoCL,OAAO,CAACO,OAAR,EAApC,CAAH;AAEAhF,IAAAA,KAAK,CAACiF,cAAN,CAAqBH,IAArB,EAA2B9E,KAAK,CAAC+C,KAAjC;AACD;AATiB,CAApB;AAYA,IAAMmC,qBAAqB,GAAG,0BAC5Bd,IAD4B,EAE5BO,WAF4B,EAG5B,UAACH,OAAD,EAAUC,OAAV;AAAA,SAAuB;AACrBhD,IAAAA,iBAAiB,EAAE+C,OAAO,CAACW,UAAR,EADE;AAErBrB,IAAAA,MAAM,EAAEW,OAAO,CAACX,MAAR;AAFa,GAAvB;AAAA,CAH4B,EAO5BS,YAP4B,CAA9B;eASeW,qB","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 DragHandleSpace,\n ExpandedInput,\n PrimaryBlock,\n Row,\n SecondaryBlock,\n UnderlinedInput\n} from './common';\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.secondaryBackground()\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};\n\nexport class TraitTile extends React.Component {\n state = {};\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (nextProps.currentPosition !== this.props.currentPosition || (this.secondaryBlock && this.secondaryBlock.scrollLeft !== nextProps.currentPosition)) {\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 { trait: { scorePointsDescriptors } } = 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 trait: {\n name,\n standards,\n description,\n scorePointsDescriptors\n },\n scorePointsValues,\n showStandards,\n showDescription,\n enableDragAndDrop\n } = this.props;\n const { anchorEl } = this.state;\n\n const dragSourceOpts = {};\n const pluginProps = {\n image: { disabled: true },\n math: { disabled: true }\n };\n\n return connectDragSource(\n connectDropTarget(\n <div>\n <Row>\n <PrimaryBlock>\n {enableDragAndDrop ?\n <span className={classes.dragHandle}>\n <DragIndicatorIcon className={classes.actions}/>\n </span> : null\n }\n <div className={classes.controls}>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={this.handleClick}\n >\n <MoreVertIcon/>\n </IconButton>\n <Menu\n id=\"long-menu\"\n anchorEl={anchorEl}\n keepMounted\n open={!!anchorEl}\n onClose={this.handleClose}\n >\n {['Remove Trait'].map((option) => (\n <MenuItem\n key={option}\n onClick={this.openMenu}\n >\n {option}\n </MenuItem>\n ))}\n </Menu>\n </div>\n\n <UnderlinedInput\n markup={name}\n onChange={name => this.onTraitChanged({ name })}\n pluginProps={pluginProps}\n placeholder='Enter Trait'\n />\n </PrimaryBlock>\n <SecondaryBlock\n setRef={ref => {\n this.secondaryBlock = ref;\n }}\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 />\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 />\n </Block>\n )}\n\n {(scorePointsValues || []).map((scorePointsValue, index) => {\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 />\n </Block>\n )\n })}\n </SecondaryBlock>\n </Row>\n </div>\n ),\n dragSourceOpts\n );\n }\n}\n\nTraitTile.propTypes = {\n connectDragSource: PropTypes.func.isRequired,\n connectDropTarget: 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};\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(\n NAME,\n traitSource,\n (connect, monitor) => ({\n connectDragSource: connect.dragSource(),\n isDragging: monitor.isDragging()\n })\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(\n NAME,\n traitTarget,\n (connect, monitor) => ({\n connectDropTarget: connect.dropTarget(),\n isOver: monitor.isOver()\n })\n)(StyledSource);\n\nexport default StyledSourceAndTarget;\n"],"file":"trait.js"}
|
|
1
|
+
{"version":3,"sources":["../src/trait.jsx"],"names":["log","styles","actions","color","text","controls","display","justifyContent","position","top","right","cursor","dragHandle","left","DragHandleSpace","removeLabel","whiteSpace","TraitTile","params","props","trait","onTraitChanged","Object","keys","forEach","key","descriptor","value","scorePointsDescriptors","length","event","setState","anchorEl","currentTarget","secondaryBlock","scrollTo","onTraitRemoved","handleClose","nextProps","currentPosition","scrollLeft","scrollToPosition","classes","connectDragSource","connectDropTarget","connectDragPreview","name","standards","description","scorePointsValues","showStandards","showDescription","enableDragAndDrop","secondaryBlockWidth","spellCheck","uploadSoundSupport","state","pluginProps","image","disabled","math","handleClick","openMenu","__html","labelPlugins","ref","join","split","map","scorePointsValue","index","adjustedBlockWidth","BlockWidth","remainingSpace","scoreDescriptor","e","onScorePointDescriptorChange","React","Component","propTypes","PropTypes","func","isRequired","object","isDragging","bool","id","any","isOver","number","shape","string","arrayOf","StyledTrait","NAME","traitSource","beginDrag","StyledSource","connect","monitor","dragSource","dragPreview","traitTarget","hover","drop","item","getItem","didDrop","onTraitDropped","StyledSourceAndTarget","dropTarget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAUA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,sDAAN,CAAZ;AAEA,IAAMC,MAAM,GAAG;AACbC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAEA,gBAAMC,IAAN;AADA,GADI;AAIbC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,OAAO,EAAE,MADD;AAERC,IAAAA,cAAc,EAAE,UAFR;AAGRC,IAAAA,QAAQ,EAAE,UAHF;AAIRC,IAAAA,GAAG,EAAE,MAJG;AAKRC,IAAAA,KAAK,EAAE,KALC;AAMRC,IAAAA,MAAM,EAAE;AANA,GAJG;AAYbC,EAAAA,UAAU,EAAE;AACVJ,IAAAA,QAAQ,EAAE,UADA;AAEVC,IAAAA,GAAG,EAAE,MAFK;AAGVI,IAAAA,IAAI,aAAMC,uBAAN,OAHM;AAIVH,IAAAA,MAAM,EAAE;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GxEjB,IAAAA,UAAU,EAAEe,OAAO,CAACf,UAAR;AAH4D,GAAvB;AAAA,CAA9B,EAIjBS,WAJiB,CAArB;AAMA,IAAMS,WAAW,GAAG;AAClBC,EAAAA,KADkB,mBACV;AACNvG,IAAAA,GAAG,CAAC,SAAD,CAAH;AACD,GAHiB;AAIlBwG,EAAAA,IAJkB,gBAIbrF,KAJa,EAINgF,OAJM,EAIG;AACnB,QAAMM,IAAI,GAAGN,OAAO,CAACO,OAAR,EAAb;AACA1G,IAAAA,GAAG,CAAC,eAAD,EAAkByG,IAAlB,EAAwB,UAAxB,EAAoCN,OAAO,CAACQ,OAAR,EAApC,CAAH;AAEAxF,IAAAA,KAAK,CAACyF,cAAN,CAAqBH,IAArB,EAA2BtF,KAAK,CAACmD,KAAjC;AACD;AATiB,CAApB;AAYA,IAAMuC,qBAAqB,GAAG,0BAAWf,IAAX,EAAiBQ,WAAjB,EAA8B,UAACJ,OAAD,EAAUC,OAAV;AAAA,SAAuB;AACjFvD,IAAAA,iBAAiB,EAAEsD,OAAO,CAACY,UAAR,EAD8D;AAEjFtB,IAAAA,MAAM,EAAEW,OAAO,CAACX,MAAR;AAFyE,GAAvB;AAAA,CAA9B,EAG1BS,YAH0B,CAA9B;eAKeY,qB","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"],"file":"trait.js"}
|
|
@@ -39,9 +39,11 @@ var _renderUi = require("@pie-lib/render-ui");
|
|
|
39
39
|
|
|
40
40
|
var _common = require("./common");
|
|
41
41
|
|
|
42
|
+
var _utils = require("./utils");
|
|
43
|
+
|
|
42
44
|
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); }; }
|
|
43
45
|
|
|
44
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
46
|
+
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; } }
|
|
45
47
|
|
|
46
48
|
var styles = {
|
|
47
49
|
label: {
|
|
@@ -134,6 +136,7 @@ var TraitsHeaderTile = /*#__PURE__*/function (_React$Component) {
|
|
|
134
136
|
scorePointsLabels = _this$props2.scorePointsLabels,
|
|
135
137
|
traitLabel = _this$props2.traitLabel,
|
|
136
138
|
classes = _this$props2.classes,
|
|
139
|
+
currentPosition = _this$props2.currentPosition,
|
|
137
140
|
showStandards = _this$props2.showStandards,
|
|
138
141
|
onTraitLabelChange = _this$props2.onTraitLabelChange,
|
|
139
142
|
showDescription = _this$props2.showDescription,
|
|
@@ -142,15 +145,11 @@ var TraitsHeaderTile = /*#__PURE__*/function (_React$Component) {
|
|
|
142
145
|
updateMaxPointsFieldValue = _this$props2.updateMaxPointsFieldValue,
|
|
143
146
|
scaleIndex = _this$props2.scaleIndex,
|
|
144
147
|
showScorePointLabels = _this$props2.showScorePointLabels,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
math: {
|
|
151
|
-
disabled: true
|
|
152
|
-
}
|
|
153
|
-
};
|
|
148
|
+
secondaryBlockWidth = _this$props2.secondaryBlockWidth,
|
|
149
|
+
setSecondaryBlockRef = _this$props2.setSecondaryBlockRef,
|
|
150
|
+
spellCheck = _this$props2.spellCheck,
|
|
151
|
+
uploadSoundSupport = _this$props2.uploadSoundSupport,
|
|
152
|
+
maxPointsEnabled = _this$props2.maxPointsEnabled;
|
|
154
153
|
var anchorEl = this.state.anchorEl;
|
|
155
154
|
return /*#__PURE__*/_react["default"].createElement(_common.Row, {
|
|
156
155
|
className: classes.greyHeader,
|
|
@@ -160,9 +159,11 @@ var TraitsHeaderTile = /*#__PURE__*/function (_React$Component) {
|
|
|
160
159
|
}, showLevelTagInput && /*#__PURE__*/_react["default"].createElement(_common.SimpleInput, {
|
|
161
160
|
markup: traitLabel || 'Trait',
|
|
162
161
|
onChange: onTraitLabelChange,
|
|
163
|
-
pluginProps:
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
pluginProps: _utils.labelPlugins,
|
|
163
|
+
spellCheck: spellCheck,
|
|
164
|
+
label: "Level Label",
|
|
165
|
+
uploadSoundSupport: uploadSoundSupport
|
|
166
|
+
}), /*#__PURE__*/_react["default"].createElement(_common.ScaleSettings, null, /*#__PURE__*/_react["default"].createElement("div", null, "Scale ", scaleIndex + 1), maxPointsEnabled && /*#__PURE__*/_react["default"].createElement(_common.MaxPointsPicker, {
|
|
166
167
|
maxPoints: maxPoints,
|
|
167
168
|
onChange: updateMaxPointsFieldValue
|
|
168
169
|
}), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
@@ -187,12 +188,16 @@ var TraitsHeaderTile = /*#__PURE__*/function (_React$Component) {
|
|
|
187
188
|
_this2.secondaryBlock = ref;
|
|
188
189
|
setSecondaryBlockRef(ref);
|
|
189
190
|
}
|
|
190
|
-
}
|
|
191
|
+
},
|
|
192
|
+
width: "".concat(secondaryBlockWidth, "px")
|
|
191
193
|
}, showStandards && /*#__PURE__*/_react["default"].createElement(_common.Block, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
192
194
|
className: classes.label
|
|
193
195
|
}, "Standard(s)")), showDescription && /*#__PURE__*/_react["default"].createElement(_common.Block, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
194
196
|
className: classes.label
|
|
195
197
|
}, "Description")), scorePointsValues.map(function (scorePointsValue, index) {
|
|
198
|
+
var adjustedBlockWidth = _common.BlockWidth + 2 * 8; // 8 is padding
|
|
199
|
+
|
|
200
|
+
var remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 128;
|
|
196
201
|
var value = scorePointsValues.length - index - 1;
|
|
197
202
|
var scoreDescriptor;
|
|
198
203
|
|
|
@@ -207,14 +212,18 @@ var TraitsHeaderTile = /*#__PURE__*/function (_React$Component) {
|
|
|
207
212
|
}, /*#__PURE__*/_react["default"].createElement(_common.ScorePoint, {
|
|
208
213
|
scorePointsValue: scorePointsValue,
|
|
209
214
|
scoreDescriptor: scoreDescriptor,
|
|
210
|
-
pluginProps:
|
|
215
|
+
pluginProps: _utils.labelPlugins,
|
|
211
216
|
showScorePointLabels: showScorePointLabels,
|
|
212
217
|
onChange: function onChange(scorePointLabel) {
|
|
213
218
|
return _this2.onScorePointLabelChange({
|
|
214
219
|
scorePointLabel: scorePointLabel,
|
|
215
220
|
value: value
|
|
216
221
|
});
|
|
217
|
-
}
|
|
222
|
+
},
|
|
223
|
+
alignToRight: remainingSpace < 296 // 296 is the space required for the toolbar
|
|
224
|
+
,
|
|
225
|
+
spellCheck: spellCheck,
|
|
226
|
+
uploadSoundSupport: uploadSoundSupport
|
|
218
227
|
}));
|
|
219
228
|
})));
|
|
220
229
|
}
|
|
@@ -237,9 +246,11 @@ TraitsHeaderTile.propTypes = {
|
|
|
237
246
|
updateMaxPointsFieldValue: _propTypes["default"].func,
|
|
238
247
|
scaleIndex: _propTypes["default"].number,
|
|
239
248
|
currentPosition: _propTypes["default"].number,
|
|
249
|
+
secondaryBlockWidth: _propTypes["default"].number,
|
|
240
250
|
showDeleteScaleModal: _propTypes["default"].func,
|
|
241
251
|
showScorePointLabels: _propTypes["default"].bool,
|
|
242
|
-
setSecondaryBlockRef: _propTypes["default"].func
|
|
252
|
+
setSecondaryBlockRef: _propTypes["default"].func,
|
|
253
|
+
uploadSoundSupport: _propTypes["default"].object
|
|
243
254
|
};
|
|
244
255
|
|
|
245
256
|
var _default = (0, _styles.withStyles)(styles)(TraitsHeaderTile);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/traitsHeader.jsx"],"names":["styles","label","textAlign","width","border","margin","padding","display","alignItems","justifyContent","greyHeader","background","color","secondaryBackground","borderRadius","position","primaryBlockGreyHeader","paddingTop","TraitsHeaderTile","anchorEl","scorePointLabel","value","props","scorePointsLabels","onScaleChange","length","event","setState","currentTarget","secondaryBlock","scrollTo","left","showDeleteScaleModal","handleClose","nextProps","currentPosition","scrollToPosition","scorePointsValues","traitLabel","classes","showStandards","onTraitLabelChange","showDescription","showLevelTagInput","maxPoints","updateMaxPointsFieldValue","scaleIndex","showScorePointLabels","setSecondaryBlockRef","pluginProps","image","disabled","math","state","HeaderHeightLarge","HeaderHeight","handleClick","map","option","openMenu","ref","scorePointsValue","index","scoreDescriptor","e","onScorePointLabelChange","React","Component","propTypes","PropTypes","object","isRequired","func","arrayOf","number","string","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAaA,IAAMA,MAAM,GAAG;AACbC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAE,QADN;AAELC,IAAAA,KAAK,EAAE,OAFF;AAGLC,IA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A,iBAAiB,EAAE0B,sBAAUO,IARF;AAS3BlC,EAAAA,eAAe,EAAE2B,sBAAUO,IATA;AAU3BhC,EAAAA,SAAS,EAAEyB,sBAAUK,MAVM;AAW3B7B,EAAAA,yBAAyB,EAAEwB,sBAAUG,IAXV;AAY3B1B,EAAAA,UAAU,EAAEuB,sBAAUK,MAZK;AAa3BvC,EAAAA,eAAe,EAAEkC,sBAAUK,MAbA;AAc3B1C,EAAAA,oBAAoB,EAAEqC,sBAAUG,IAdL;AAe3BzB,EAAAA,oBAAoB,EAAEsB,sBAAUO,IAfL;AAgB3B5B,EAAAA,oBAAoB,EAAEqB,sBAAUG;AAhBL,CAA7B;;eAmBe,wBAAWxE,MAAX,EAAmBkB,gBAAnB,C","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 PrimaryBlock,\n Row,\n SecondaryBlock,\n ScorePoint,\n MaxPointsPicker,\n SimpleInput,\n ScaleSettings,\n HeaderHeight,\n HeaderHeightLarge\n} from './common';\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 showStandards,\n onTraitLabelChange,\n showDescription,\n showLevelTagInput,\n maxPoints,\n updateMaxPointsFieldValue,\n scaleIndex,\n showScorePointLabels,\n setSecondaryBlockRef,\n } = this.props;\n const pluginProps = {\n image: { disabled: true },\n math: { disabled: true }\n };\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={pluginProps}\n label='Level Label'\n />\n )}\n\n <ScaleSettings>\n <div>\n Scale {scaleIndex + 1}\n </div>\n\n <MaxPointsPicker\n maxPoints={maxPoints}\n onChange={updateMaxPointsFieldValue}\n />\n\n <div>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={this.handleClick}\n >\n <MoreVertIcon/>\n </IconButton>\n <Menu\n id=\"long-menu\"\n anchorEl={anchorEl}\n keepMounted\n open={!!anchorEl}\n onClose={this.handleClose}\n >\n {['Remove Scale'].map((option) => (\n <MenuItem\n key={option}\n onClick={this.openMenu}\n >\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\n setSecondaryBlockRef(ref);\n }\n }}\n >\n\n {showStandards && (\n <Block>\n <div className={classes.label}>\n Standard(s)\n </div>\n </Block>\n )}\n\n {showDescription && (\n <Block>\n <div className={classes.label}>\n Description\n </div>\n </Block>\n )}\n\n {scorePointsValues.map((scorePointsValue, index) => {\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={pluginProps}\n showScorePointLabels={showScorePointLabels}\n onChange={scorePointLabel => this.onScorePointLabelChange({ scorePointLabel, value })}\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 showDeleteScaleModal: PropTypes.func,\n showScorePointLabels: PropTypes.bool,\n setSecondaryBlockRef: PropTypes.func\n};\n\nexport default withStyles(styles)(TraitsHeaderTile);\n"],"file":"traitsHeader.js"}
|
|
1
|
+
{"version":3,"sources":["../src/traitsHeader.jsx"],"names":["styles","label","textAlign","width","border","margin","padding","display","alignItems","justifyContent","greyHeader","background","color","secondaryBackground","borderRadius","position","primaryBlockGreyHeader","paddingTop","TraitsHeaderTile","anchorEl","scorePointLabel","value","props","scorePointsLabels","onScaleChange","length","event","setState","currentTarget","secondaryBlock","scrollTo","left","showDeleteScaleModal","handleClose","nextProps","currentPosition","scrollToPosition","scorePointsValues","traitLabel","classes","showStandards","onTraitLabelChange","showDescription","showLevelTagInput","maxPoints","updateMaxPointsFieldValue","scaleIndex","showScorePointLabels","secondaryBlockWidth","setSecondaryBlockRef","spellCheck","uploadSoundSupport","maxPointsEnabled","state","HeaderHeightLarge","HeaderHeight","labelPlugins","handleClick","map","option","openMenu","ref","scorePointsValue","index","adjustedBlockWidth","BlockWidth","remainingSpace","scoreDescriptor","e","onScorePointLabelChange","React","Component","propTypes","PropTypes","object","isRequired","func","arrayOf","number","string","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAaA;;;;;;AAEA,IAAMA,MAAM,GAAG;AACbC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAE,QADN;AAELC,IAAAA,KAAK,EAAE,OAFF;AAGLC,IAAAA,MAAM,EAAE,MAHH;AAILC,IAAAA,MAAM,EAAE,KAJH;AAKLC,IAAAA,OAAO,EAAE,QALJ;AAMLC,IAAAA,OAAO,EAAE,MANJ;AAOLC,IAAAA,UAAU,EAAE,QAPP;AAQLC,IAAAA,cAAc,EAAE;AARX,GADM;AAWbC,EAAAA,UAAU,EAAE;AACVC,IAAAA,UAAU,EAAEC,gBAAMC,mBAAN,EADF;AAEVC,IAAAA,YAAY,EAAE,KAFJ;AAGVC,IAAAA,QAAQ,EAAE;AAHA,GAXC;AAgBbC,EAAAA,sBAAsB,EAAE;AACtBC,IAAAA,UAAU,EAAE;AADU;AAhBX,CAAf;;IAqBaC,gB;;;;;;;;;;;;;;;8FACH;AACNC,MAAAA,QAAQ,EAAE;AADJ,K;gHAUkB,gBAAgC;AAAA,UAA7BC,eAA6B,QAA7BA,eAA6B;AAAA,UAAZC,KAAY,QAAZA,KAAY;AACxD,wBAA6C,MAAKC,KAAlD;AAAA,UAAQC,iBAAR,eAAQA,iBAAR;AAAA,UAA2BC,aAA3B,eAA2BA,aAA3B;AAEA,UAAIH,KAAK,GAAG,CAA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AbA;AAc3B9B,EAAAA,mBAAmB,EAAEyB,sBAAUK,MAdJ;AAe3B9C,EAAAA,oBAAoB,EAAEyC,sBAAUG,IAfL;AAgB3B7B,EAAAA,oBAAoB,EAAE0B,sBAAUO,IAhBL;AAiB3B/B,EAAAA,oBAAoB,EAAEwB,sBAAUG,IAjBL;AAkB3BzB,EAAAA,kBAAkB,EAAEsB,sBAAUC;AAlBH,CAA7B;;eAqBe,wBAAW1E,MAAX,EAAmBkB,gBAAnB,C","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"],"file":"traitsHeader.js"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.labelPlugins = exports.filteredDefaultPlugins = void 0;
|
|
7
|
+
|
|
8
|
+
var _editableHtml = require("@pie-lib/editable-html");
|
|
9
|
+
|
|
10
|
+
var filteredDefaultPlugins = (_editableHtml.DEFAULT_PLUGINS || []).filter(function (p) {
|
|
11
|
+
return p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list';
|
|
12
|
+
});
|
|
13
|
+
exports.filteredDefaultPlugins = filteredDefaultPlugins;
|
|
14
|
+
var labelPlugins = {
|
|
15
|
+
image: {
|
|
16
|
+
disabled: true
|
|
17
|
+
},
|
|
18
|
+
math: {
|
|
19
|
+
disabled: true
|
|
20
|
+
},
|
|
21
|
+
audio: {
|
|
22
|
+
disabled: true
|
|
23
|
+
},
|
|
24
|
+
video: {
|
|
25
|
+
disabled: true
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.labelPlugins = labelPlugins;
|
|
29
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils.js"],"names":["filteredDefaultPlugins","DEFAULT_PLUGINS","filter","p","labelPlugins","image","disabled","math","audio","video"],"mappings":";;;;;;;AAAA;;AAEO,IAAMA,sBAAsB,GAAG,CAACC,iCAAmB,EAApB,EAAwBC,MAAxB,CACpC,UAACC,CAAD;AAAA,SAAOA,CAAC,KAAK,OAAN,IAAiBA,CAAC,KAAK,eAAvB,IAA0CA,CAAC,KAAK,eAAvD;AAAA,CADoC,CAA/B;;AAIA,IAAMC,YAAY,GAAG;AAC1BC,EAAAA,KAAK,EAAE;AAAEC,IAAAA,QAAQ,EAAE;AAAZ,GADmB;AAE1BC,EAAAA,IAAI,EAAE;AAAED,IAAAA,QAAQ,EAAE;AAAZ,GAFoB;AAG1BE,EAAAA,KAAK,EAAE;AAAEF,IAAAA,QAAQ,EAAE;AAAZ,GAHmB;AAI1BG,EAAAA,KAAK,EAAE;AAAEH,IAAAA,QAAQ,EAAE;AAAZ;AAJmB,CAArB","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"],"file":"utils.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multi-trait-rubric-configure",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@material-ui/core": "^3.9.2",
|
|
9
9
|
"@material-ui/icons": "^3.0.1",
|
|
10
|
-
"@pie-framework/pie-configure-events": "^1.
|
|
11
|
-
"@pie-lib/config-ui": "
|
|
12
|
-
"@pie-lib/editable-html": "
|
|
13
|
-
"@pie-lib/render-ui": "^4.
|
|
14
|
-
"@pie-lib/rubric": "
|
|
15
|
-
"@pie-lib/scoring-config": "
|
|
10
|
+
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
11
|
+
"@pie-lib/config-ui": "12.0.0-beta.3",
|
|
12
|
+
"@pie-lib/editable-html": "10.0.0-beta.4",
|
|
13
|
+
"@pie-lib/render-ui": "^4.14.12",
|
|
14
|
+
"@pie-lib/rubric": "1.0.0-beta.2",
|
|
15
|
+
"@pie-lib/scoring-config": "4.0.0-beta.2",
|
|
16
16
|
"debug": "^3.1.0",
|
|
17
17
|
"lodash": "^4.17.15",
|
|
18
18
|
"prop-types": "^15.6.2",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,63 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.13](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-controller@1.2.12...@pie-element/multi-trait-rubric-controller@1.2.13) (2023-01-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **multi-trait-rubric:** fix validation bugs, update documentation. Fixed match docs typo PD-2427 ([26d598e](https://github.com/pie-framework/pie-elements/commit/26d598e7a32d50ed176d566605bb6b4ebdc07a2c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.2.12](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-controller@1.2.11...@pie-element/multi-trait-rubric-controller@1.2.12) (2022-12-07)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* update libs ([441f403](https://github.com/pie-framework/pie-elements/commit/441f403870b7bec0d61fab58b8d93dbe0ead4c32))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [1.2.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-controller@1.2.6...@pie-element/multi-trait-rubric-controller@1.2.8) (2021-11-11)
|
|
29
|
+
|
|
30
|
+
**Note:** Version bump only for package @pie-element/multi-trait-rubric-controller
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [1.2.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-controller@1.2.6...@pie-element/multi-trait-rubric-controller@1.2.7) (2021-11-11)
|
|
37
|
+
|
|
38
|
+
**Note:** Version bump only for package @pie-element/multi-trait-rubric-controller
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## [1.2.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-controller@1.2.4...@pie-element/multi-trait-rubric-controller@1.2.6) (2021-08-05)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Bug Fixes
|
|
48
|
+
|
|
49
|
+
* force bump ([5ea7295](https://github.com/pie-framework/pie-elements/commit/5ea7295e4755fbc492a76e7ec69e5fc35b196919))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## [1.2.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-controller@1.2.3...@pie-element/multi-trait-rubric-controller@1.2.4) (2021-06-29)
|
|
56
|
+
|
|
57
|
+
**Note:** Version bump only for package @pie-element/multi-trait-rubric-controller
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
6
63
|
## [1.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-controller@1.2.0...@pie-element/multi-trait-rubric-controller@1.2.3) (2021-03-03)
|
|
7
64
|
|
|
8
65
|
**Note:** Version bump only for package @pie-element/multi-trait-rubric-controller
|