@pie-element/explicit-constructed-response 6.20.1-next.0 → 6.20.1-next.14

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.
@@ -8,7 +8,7 @@
8
8
  "@material-ui/core": "^3.9.2",
9
9
  "@material-ui/icons": "^3.0.1",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/pie-toolbox": "1.28.0",
11
+ "@pie-lib/pie-toolbox": "1.29.0",
12
12
  "classnames": "^2.2.6",
13
13
  "debug": "^3.1.0",
14
14
  "lodash": "^4.17.15",
@@ -8,7 +8,7 @@
8
8
  "author": "",
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
- "@pie-lib/pie-toolbox": "1.28.0",
11
+ "@pie-lib/pie-toolbox": "1.29.0",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15",
14
14
  "type-of": "^2.0.1"
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.20.0/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@4.12.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.21.1/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@4.23.1/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.20.0/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.12.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.21.1/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.23.1/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -19152,8 +19152,10 @@ var mathjaxScript = {};
19152
19152
  Object.defineProperty(mathjaxScript, "__esModule", {
19153
19153
  value: true
19154
19154
  });
19155
- mathjaxScript.initializeMathJax = void 0;
19155
+ mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
19156
19156
  var _renderMath = renderMath$2;
19157
+ var MathJaxVersion = '3.2.2';
19158
+ mathjaxScript.MathJaxVersion = MathJaxVersion;
19157
19159
  var initializeMathJax = function initializeMathJax(renderOpts) {
19158
19160
  if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
19159
19161
  console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
@@ -19224,7 +19226,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
19224
19226
  };
19225
19227
  var script = document.createElement('script');
19226
19228
  script.type = 'text/javascript';
19227
- script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-chtml-full.js';
19229
+ script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
19228
19230
  script.async = true;
19229
19231
  document.body.appendChild(script);
19230
19232
  });
@@ -79053,7 +79055,7 @@ getDefaultExportFromCjs(mathRendering);
79053
79055
  fixMathElements(executeOn);
79054
79056
  adjustMathMLStyle(executeOn);
79055
79057
  var mathJaxCustomKey = getMathJaxCustomKey();
79056
- if (!window.MathJax && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
79058
+ if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
79057
79059
  renderOpts = renderOpts || defaultOpts();
79058
79060
  (0, _mathjaxScript.initializeMathJax)(renderOpts);
79059
79061
  }
@@ -122189,6 +122191,27 @@ const {findKey: require$$10$5} = _dll_lodash;
122189
122191
  var _findKey = _interopRequireDefault(require$$10$5);
122190
122192
  var _choice = _interopRequireDefault(choice$1);
122191
122193
  var _dragInTheBlankDp = _interopRequireDefault(dragInTheBlankDp);
122194
+ function ownKeys(object, enumerableOnly) {
122195
+ var keys = Object.keys(object);
122196
+ if (Object.getOwnPropertySymbols) {
122197
+ var symbols = Object.getOwnPropertySymbols(object);
122198
+ (enumerableOnly && (symbols = symbols.filter(function (sym) {
122199
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
122200
+ })), keys.push.apply(keys, symbols));
122201
+ }
122202
+ return keys;
122203
+ }
122204
+ function _objectSpread(target) {
122205
+ for (var i = 1; i < arguments.length; i++) {
122206
+ var source = null != arguments[i] ? arguments[i] : {};
122207
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
122208
+ (0, _defineProperty2["default"])(target, key, source[key]);
122209
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
122210
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
122211
+ });
122212
+ }
122213
+ return target;
122214
+ }
122192
122215
  function _createSuper(Derived) {
122193
122216
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
122194
122217
  return function _createSuperInternal() {
@@ -122259,7 +122282,9 @@ const {findKey: require$$10$5} = _dll_lodash;
122259
122282
  });
122260
122283
  return foundChoice === undefined;
122261
122284
  });
122262
- var elementStyle = this.getStyleForWrapper();
122285
+ var elementStyle = _objectSpread(_objectSpread({}, this.getStyleForWrapper()), {}, {
122286
+ minWidth: '100px'
122287
+ });
122263
122288
  return _react["default"].createElement("div", {
122264
122289
  style: elementStyle
122265
122290
  }, _react["default"].createElement(_dragInTheBlankDp["default"], {
@@ -122301,12 +122326,12 @@ const require$$16 = _dll_classnames;
122301
122326
  });
122302
122327
  exports["default"] = exports.DRAG_TYPE = exports.BlankContent = void 0;
122303
122328
  var _objectWithoutProperties2 = _interopRequireDefault(objectWithoutProperties.exports);
122329
+ var _defineProperty2 = _interopRequireDefault(defineProperty$4.exports);
122304
122330
  var _classCallCheck2 = _interopRequireDefault(classCallCheck$3.exports);
122305
122331
  var _createClass2 = _interopRequireDefault(createClass$2.exports);
122306
122332
  var _inherits2 = _interopRequireDefault(inherits$2.exports);
122307
122333
  var _possibleConstructorReturn2 = _interopRequireDefault(possibleConstructorReturn$2.exports);
122308
122334
  var _getPrototypeOf2 = _interopRequireDefault(getPrototypeOf$2.exports);
122309
- var _defineProperty2 = _interopRequireDefault(defineProperty$4.exports);
122310
122335
  var _react = _interopRequireDefault(require$$8$5);
122311
122336
  var _reactDom = _interopRequireDefault(require$$9$6);
122312
122337
  var _propTypes = _interopRequireDefault(require$$10$4);
@@ -122379,10 +122404,7 @@ const require$$16 = _dll_classnames;
122379
122404
  backgroundColor: _renderUi.color.background(),
122380
122405
  border: ("2px dashed ").concat(_renderUi.color.text()),
122381
122406
  color: _renderUi.color.text(),
122382
- minWidth: '90px',
122383
122407
  fontSize: 'inherit',
122384
- minHeight: '32px',
122385
- height: 'auto',
122386
122408
  maxWidth: '374px',
122387
122409
  position: 'relative',
122388
122410
  borderRadius: '3px'
@@ -122424,7 +122446,8 @@ const require$$16 = _dll_classnames;
122424
122446
  (0, _classCallCheck2["default"])(this, BlankContent);
122425
122447
  _this = _super.call(this);
122426
122448
  _this.state = {
122427
- height: 0
122449
+ height: 0,
122450
+ width: 0
122428
122451
  };
122429
122452
  return _this;
122430
122453
  }
@@ -122438,17 +122461,33 @@ const require$$16 = _dll_classnames;
122438
122461
  if (JSON.stringify(currentChoice) !== JSON.stringify(prevChoice)) {
122439
122462
  if (!currentChoice) {
122440
122463
  this.setState({
122441
- height: 0
122464
+ height: 0,
122465
+ width: 0
122442
122466
  });
122443
122467
  return;
122444
122468
  }
122445
122469
  setTimeout(function () {
122446
- _this2.setState({
122447
- height: _this2.spanRef.offsetHeight
122448
- });
122470
+ _this2.updateDimensions();
122449
122471
  }, 300);
122450
122472
  }
122451
122473
  }
122474
+ }, {
122475
+ key: "updateDimensions",
122476
+ value: function updateDimensions() {
122477
+ var _this$spanRef, _this$spanRef2;
122478
+ var height = ((_this$spanRef = this.spanRef) === null || _this$spanRef === void 0 ? void 0 : _this$spanRef.offsetHeight) || 0;
122479
+ var width = ((_this$spanRef2 = this.spanRef) === null || _this$spanRef2 === void 0 ? void 0 : _this$spanRef2.offsetWidth) || 0;
122480
+ var responseAreaHeight = parseFloat(this.props.emptyResponseAreaHeight) || 0;
122481
+ var responseAreaWidth = parseFloat(this.props.emptyResponseAreaWidth) || 0;
122482
+ if (height > responseAreaHeight || width > responseAreaWidth) {
122483
+ this.setState(function (prevState) {
122484
+ return {
122485
+ width: width > responseAreaWidth ? width : prevState.width,
122486
+ height: height > responseAreaHeight ? height : prevState.height
122487
+ };
122488
+ });
122489
+ }
122490
+ }
122452
122491
  }, {
122453
122492
  key: "addDraggableFalseAttributes",
122454
122493
  value: function addDraggableFalseAttributes(parent) {
@@ -122458,6 +122497,19 @@ const require$$16 = _dll_classnames;
122458
122497
  }
122459
122498
  });
122460
122499
  }
122500
+ }, {
122501
+ key: "getRootDimensions",
122502
+ value: function getRootDimensions() {
122503
+ var rootStyle = {
122504
+ height: this.state.height || this.props.emptyResponseAreaHeight,
122505
+ width: this.state.width || this.props.emptyResponseAreaWidth
122506
+ };
122507
+ return _objectSpread(_objectSpread(_objectSpread({}, rootStyle), this.props.emptyResponseAreaWidth ? {} : {
122508
+ minWidth: 90
122509
+ }), this.props.emptyResponseAreaHeight ? {} : {
122510
+ minHeight: 32
122511
+ });
122512
+ }
122461
122513
  }, {
122462
122514
  key: "render",
122463
122515
  value: function render() {
@@ -122493,9 +122545,7 @@ const require$$16 = _dll_classnames;
122493
122545
  }, ' ')),
122494
122546
  className: (0, _classnames3["default"])(classes.chip, isOver && classes.over, (_classnames2 = {}, (0, _defineProperty2["default"])(_classnames2, classes.correct, correct !== undefined && correct), (0, _defineProperty2["default"])(_classnames2, classes.incorrect, correct !== undefined && !correct), _classnames2)),
122495
122547
  variant: disabled ? 'outlined' : undefined,
122496
- style: _objectSpread({}, this.state.height ? {
122497
- height: this.state.height
122498
- } : {}),
122548
+ style: _objectSpread({}, this.getRootDimensions()),
122499
122549
  classes: {
122500
122550
  label: isOver && classes.over
122501
122551
  }
@@ -122505,7 +122555,11 @@ const require$$16 = _dll_classnames;
122505
122555
  return BlankContent;
122506
122556
  })(_react["default"].Component);
122507
122557
  exports.BlankContent = BlankContent;
122508
- (0, _defineProperty2["default"])(BlankContent, "propTypes", {
122558
+ BlankContent.defaultProps = {
122559
+ emptyResponseAreaWidth: 0,
122560
+ emptyResponseAreaHeight: 0
122561
+ };
122562
+ BlankContent.propTypes = {
122509
122563
  id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
122510
122564
  disabled: _propTypes["default"].bool,
122511
122565
  duplicates: _propTypes["default"].bool,
@@ -122514,8 +122568,10 @@ const require$$16 = _dll_classnames;
122514
122568
  isOver: _propTypes["default"].bool,
122515
122569
  dragItem: _propTypes["default"].object,
122516
122570
  correct: _propTypes["default"].bool,
122517
- onChange: _propTypes["default"].func
122518
- });
122571
+ onChange: _propTypes["default"].func,
122572
+ emptyResponseAreaWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
122573
+ emptyResponseAreaHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
122574
+ };
122519
122575
  var StyledBlankContent = useStyles(BlankContent);
122520
122576
  var connectedBlankContent = useStyles(function (_ref4) {
122521
122577
  var connectDragSource = _ref4.connectDragSource, connectDropTarget = _ref4.connectDropTarget, props = (0, _objectWithoutProperties2["default"])(_ref4, _excluded);
@@ -122600,6 +122656,27 @@ const require$$9$5 = _dll_prop_types;
122600
122656
  var _choices = _interopRequireDefault(choices);
122601
122657
  var _blank = _interopRequireDefault(blank);
122602
122658
  var _withMask = withMask$1;
122659
+ function ownKeys(object, enumerableOnly) {
122660
+ var keys = Object.keys(object);
122661
+ if (Object.getOwnPropertySymbols) {
122662
+ var symbols = Object.getOwnPropertySymbols(object);
122663
+ (enumerableOnly && (symbols = symbols.filter(function (sym) {
122664
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
122665
+ })), keys.push.apply(keys, symbols));
122666
+ }
122667
+ return keys;
122668
+ }
122669
+ function _objectSpread(target) {
122670
+ for (var i = 1; i < arguments.length; i++) {
122671
+ var source = null != arguments[i] ? arguments[i] : {};
122672
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
122673
+ (0, _defineProperty2["default"])(target, key, source[key]);
122674
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
122675
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
122676
+ });
122677
+ }
122678
+ return target;
122679
+ }
122603
122680
  function _createSuper(Derived) {
122604
122681
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
122605
122682
  return function _createSuperInternal() {
@@ -122628,7 +122705,7 @@ const require$$9$5 = _dll_prop_types;
122628
122705
  return function (node, data, onChange) {
122629
122706
  var dataset = node.data ? node.data.dataset || ({}) : {};
122630
122707
  if (dataset.component === 'blank') {
122631
- var disabled = props.disabled, duplicates = props.duplicates, correctResponse = props.correctResponse, feedback = props.feedback, showCorrectAnswer = props.showCorrectAnswer;
122708
+ var disabled = props.disabled, duplicates = props.duplicates, correctResponse = props.correctResponse, feedback = props.feedback, showCorrectAnswer = props.showCorrectAnswer, emptyResponseAreaWidth = props.emptyResponseAreaWidth, emptyResponseAreaHeight = props.emptyResponseAreaHeight;
122632
122709
  var choiceId = showCorrectAnswer ? correctResponse[dataset.id] : data[dataset.id];
122633
122710
  var choice = choiceId && props.choices.find(function (c) {
122634
122711
  return c.id === choiceId;
@@ -122640,6 +122717,8 @@ const require$$9$5 = _dll_prop_types;
122640
122717
  duplicates: duplicates,
122641
122718
  choice: choice,
122642
122719
  id: dataset.id,
122720
+ emptyResponseAreaWidth: emptyResponseAreaWidth,
122721
+ emptyResponseAreaHeight: emptyResponseAreaHeight,
122643
122722
  onChange: onChange
122644
122723
  });
122645
122724
  }
@@ -122657,12 +122736,17 @@ const require$$9$5 = _dll_prop_types;
122657
122736
  _this = _super.call.apply(_super, [this].concat(args));
122658
122737
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPositionDirection", function (choicePosition) {
122659
122738
  var flexDirection;
122739
+ var justifyContent;
122740
+ var alignItems;
122660
122741
  switch (choicePosition) {
122661
122742
  case 'left':
122662
122743
  flexDirection = 'row';
122744
+ alignItems = 'center';
122663
122745
  break;
122664
122746
  case 'right':
122665
122747
  flexDirection = 'row-reverse';
122748
+ justifyContent = 'flex-end';
122749
+ alignItems = 'center';
122666
122750
  break;
122667
122751
  case 'below':
122668
122752
  flexDirection = 'column-reverse';
@@ -122671,7 +122755,11 @@ const require$$9$5 = _dll_prop_types;
122671
122755
  flexDirection = 'column';
122672
122756
  break;
122673
122757
  }
122674
- return flexDirection;
122758
+ return {
122759
+ flexDirection: flexDirection,
122760
+ justifyContent: justifyContent,
122761
+ alignItems: alignItems
122762
+ };
122675
122763
  });
122676
122764
  return _this;
122677
122765
  }
@@ -122691,12 +122779,12 @@ const require$$9$5 = _dll_prop_types;
122691
122779
  key: "render",
122692
122780
  value: function render() {
122693
122781
  var _this2 = this;
122694
- var _this$props = this.props, markup = _this$props.markup, duplicates = _this$props.duplicates, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange, choicesPosition = _this$props.choicesPosition, choices = _this$props.choices, correctResponse = _this$props.correctResponse, disabled = _this$props.disabled, feedback = _this$props.feedback, showCorrectAnswer = _this$props.showCorrectAnswer;
122782
+ var _this$props = this.props, markup = _this$props.markup, duplicates = _this$props.duplicates, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange, choicesPosition = _this$props.choicesPosition, choices = _this$props.choices, correctResponse = _this$props.correctResponse, disabled = _this$props.disabled, feedback = _this$props.feedback, showCorrectAnswer = _this$props.showCorrectAnswer, emptyResponseAreaWidth = _this$props.emptyResponseAreaWidth, emptyResponseAreaHeight = _this$props.emptyResponseAreaHeight;
122695
122783
  var choicePosition = choicesPosition || 'below';
122696
- var style = {
122784
+ var style = _objectSpread({
122697
122785
  display: 'flex',
122698
- flexDirection: this.getPositionDirection(choicePosition)
122699
- };
122786
+ minWidth: '100px'
122787
+ }, this.getPositionDirection(choicePosition));
122700
122788
  return _react["default"].createElement("div", {
122701
122789
  ref: function ref(_ref) {
122702
122790
  return _ref && (_this2.rootRef = _ref);
@@ -122718,7 +122806,9 @@ const require$$9$5 = _dll_prop_types;
122718
122806
  duplicates: duplicates,
122719
122807
  feedback: feedback,
122720
122808
  correctResponse: correctResponse,
122721
- showCorrectAnswer: showCorrectAnswer
122809
+ showCorrectAnswer: showCorrectAnswer,
122810
+ emptyResponseAreaWidth: emptyResponseAreaWidth,
122811
+ emptyResponseAreaHeight: emptyResponseAreaHeight
122722
122812
  }));
122723
122813
  }
122724
122814
  }]);
@@ -122739,7 +122829,9 @@ const require$$9$5 = _dll_prop_types;
122739
122829
  disabled: _propTypes["default"].bool,
122740
122830
  feedback: _propTypes["default"].object,
122741
122831
  correctResponse: _propTypes["default"].object,
122742
- showCorrectAnswer: _propTypes["default"].bool
122832
+ showCorrectAnswer: _propTypes["default"].bool,
122833
+ emptyResponseAreaWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
122834
+ emptyResponseAreaHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
122743
122835
  });
122744
122836
  })(dragInTheBlank);
122745
122837
  getDefaultExportFromCjs(dragInTheBlank);
@@ -4,11 +4,11 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.20.0"
7
+ "version": "1.21.1"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "4.12.0"
11
+ "version": "4.23.1"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.20.0/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.12.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.21.1/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.23.1/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -19115,8 +19115,10 @@ var mathjaxScript = {};
19115
19115
  Object.defineProperty(mathjaxScript, "__esModule", {
19116
19116
  value: true
19117
19117
  });
19118
- mathjaxScript.initializeMathJax = void 0;
19118
+ mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
19119
19119
  var _renderMath = renderMath$2;
19120
+ var MathJaxVersion = '3.2.2';
19121
+ mathjaxScript.MathJaxVersion = MathJaxVersion;
19120
19122
  var initializeMathJax = function initializeMathJax(renderOpts) {
19121
19123
  if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
19122
19124
  console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
@@ -19187,7 +19189,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
19187
19189
  };
19188
19190
  var script = document.createElement('script');
19189
19191
  script.type = 'text/javascript';
19190
- script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-chtml-full.js';
19192
+ script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
19191
19193
  script.async = true;
19192
19194
  document.body.appendChild(script);
19193
19195
  });
@@ -79016,7 +79018,7 @@ getDefaultExportFromCjs(mathRendering);
79016
79018
  fixMathElements(executeOn);
79017
79019
  adjustMathMLStyle(executeOn);
79018
79020
  var mathJaxCustomKey = getMathJaxCustomKey();
79019
- if (!window.MathJax && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
79021
+ if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
79020
79022
  renderOpts = renderOpts || defaultOpts();
79021
79023
  (0, _mathjaxScript.initializeMathJax)(renderOpts);
79022
79024
  }
@@ -122152,6 +122154,27 @@ const {findKey: require$$10$5} = _dll_lodash;
122152
122154
  var _findKey = _interopRequireDefault(require$$10$5);
122153
122155
  var _choice = _interopRequireDefault(choice$1);
122154
122156
  var _dragInTheBlankDp = _interopRequireDefault(dragInTheBlankDp);
122157
+ function ownKeys(object, enumerableOnly) {
122158
+ var keys = Object.keys(object);
122159
+ if (Object.getOwnPropertySymbols) {
122160
+ var symbols = Object.getOwnPropertySymbols(object);
122161
+ (enumerableOnly && (symbols = symbols.filter(function (sym) {
122162
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
122163
+ })), keys.push.apply(keys, symbols));
122164
+ }
122165
+ return keys;
122166
+ }
122167
+ function _objectSpread(target) {
122168
+ for (var i = 1; i < arguments.length; i++) {
122169
+ var source = null != arguments[i] ? arguments[i] : {};
122170
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
122171
+ (0, _defineProperty2["default"])(target, key, source[key]);
122172
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
122173
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
122174
+ });
122175
+ }
122176
+ return target;
122177
+ }
122155
122178
  function _createSuper(Derived) {
122156
122179
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
122157
122180
  return function _createSuperInternal() {
@@ -122222,7 +122245,9 @@ const {findKey: require$$10$5} = _dll_lodash;
122222
122245
  });
122223
122246
  return foundChoice === undefined;
122224
122247
  });
122225
- var elementStyle = this.getStyleForWrapper();
122248
+ var elementStyle = _objectSpread(_objectSpread({}, this.getStyleForWrapper()), {}, {
122249
+ minWidth: '100px'
122250
+ });
122226
122251
  return _react["default"].createElement("div", {
122227
122252
  style: elementStyle
122228
122253
  }, _react["default"].createElement(_dragInTheBlankDp["default"], {
@@ -122264,12 +122289,12 @@ const require$$16 = _dll_classnames;
122264
122289
  });
122265
122290
  exports["default"] = exports.DRAG_TYPE = exports.BlankContent = void 0;
122266
122291
  var _objectWithoutProperties2 = _interopRequireDefault(objectWithoutProperties.exports);
122292
+ var _defineProperty2 = _interopRequireDefault(defineProperty$4.exports);
122267
122293
  var _classCallCheck2 = _interopRequireDefault(classCallCheck$3.exports);
122268
122294
  var _createClass2 = _interopRequireDefault(createClass$2.exports);
122269
122295
  var _inherits2 = _interopRequireDefault(inherits$2.exports);
122270
122296
  var _possibleConstructorReturn2 = _interopRequireDefault(possibleConstructorReturn$2.exports);
122271
122297
  var _getPrototypeOf2 = _interopRequireDefault(getPrototypeOf$2.exports);
122272
- var _defineProperty2 = _interopRequireDefault(defineProperty$4.exports);
122273
122298
  var _react = _interopRequireDefault(require$$8$5);
122274
122299
  var _reactDom = _interopRequireDefault(require$$9$6);
122275
122300
  var _propTypes = _interopRequireDefault(require$$10$4);
@@ -122342,10 +122367,7 @@ const require$$16 = _dll_classnames;
122342
122367
  backgroundColor: _renderUi.color.background(),
122343
122368
  border: ("2px dashed ").concat(_renderUi.color.text()),
122344
122369
  color: _renderUi.color.text(),
122345
- minWidth: '90px',
122346
122370
  fontSize: 'inherit',
122347
- minHeight: '32px',
122348
- height: 'auto',
122349
122371
  maxWidth: '374px',
122350
122372
  position: 'relative',
122351
122373
  borderRadius: '3px'
@@ -122387,7 +122409,8 @@ const require$$16 = _dll_classnames;
122387
122409
  (0, _classCallCheck2["default"])(this, BlankContent);
122388
122410
  _this = _super.call(this);
122389
122411
  _this.state = {
122390
- height: 0
122412
+ height: 0,
122413
+ width: 0
122391
122414
  };
122392
122415
  return _this;
122393
122416
  }
@@ -122401,17 +122424,33 @@ const require$$16 = _dll_classnames;
122401
122424
  if (JSON.stringify(currentChoice) !== JSON.stringify(prevChoice)) {
122402
122425
  if (!currentChoice) {
122403
122426
  this.setState({
122404
- height: 0
122427
+ height: 0,
122428
+ width: 0
122405
122429
  });
122406
122430
  return;
122407
122431
  }
122408
122432
  setTimeout(function () {
122409
- _this2.setState({
122410
- height: _this2.spanRef.offsetHeight
122411
- });
122433
+ _this2.updateDimensions();
122412
122434
  }, 300);
122413
122435
  }
122414
122436
  }
122437
+ }, {
122438
+ key: "updateDimensions",
122439
+ value: function updateDimensions() {
122440
+ var _this$spanRef, _this$spanRef2;
122441
+ var height = ((_this$spanRef = this.spanRef) === null || _this$spanRef === void 0 ? void 0 : _this$spanRef.offsetHeight) || 0;
122442
+ var width = ((_this$spanRef2 = this.spanRef) === null || _this$spanRef2 === void 0 ? void 0 : _this$spanRef2.offsetWidth) || 0;
122443
+ var responseAreaHeight = parseFloat(this.props.emptyResponseAreaHeight) || 0;
122444
+ var responseAreaWidth = parseFloat(this.props.emptyResponseAreaWidth) || 0;
122445
+ if (height > responseAreaHeight || width > responseAreaWidth) {
122446
+ this.setState(function (prevState) {
122447
+ return {
122448
+ width: width > responseAreaWidth ? width : prevState.width,
122449
+ height: height > responseAreaHeight ? height : prevState.height
122450
+ };
122451
+ });
122452
+ }
122453
+ }
122415
122454
  }, {
122416
122455
  key: "addDraggableFalseAttributes",
122417
122456
  value: function addDraggableFalseAttributes(parent) {
@@ -122421,6 +122460,19 @@ const require$$16 = _dll_classnames;
122421
122460
  }
122422
122461
  });
122423
122462
  }
122463
+ }, {
122464
+ key: "getRootDimensions",
122465
+ value: function getRootDimensions() {
122466
+ var rootStyle = {
122467
+ height: this.state.height || this.props.emptyResponseAreaHeight,
122468
+ width: this.state.width || this.props.emptyResponseAreaWidth
122469
+ };
122470
+ return _objectSpread(_objectSpread(_objectSpread({}, rootStyle), this.props.emptyResponseAreaWidth ? {} : {
122471
+ minWidth: 90
122472
+ }), this.props.emptyResponseAreaHeight ? {} : {
122473
+ minHeight: 32
122474
+ });
122475
+ }
122424
122476
  }, {
122425
122477
  key: "render",
122426
122478
  value: function render() {
@@ -122456,9 +122508,7 @@ const require$$16 = _dll_classnames;
122456
122508
  }, ' ')),
122457
122509
  className: (0, _classnames3["default"])(classes.chip, isOver && classes.over, (_classnames2 = {}, (0, _defineProperty2["default"])(_classnames2, classes.correct, correct !== undefined && correct), (0, _defineProperty2["default"])(_classnames2, classes.incorrect, correct !== undefined && !correct), _classnames2)),
122458
122510
  variant: disabled ? 'outlined' : undefined,
122459
- style: _objectSpread({}, this.state.height ? {
122460
- height: this.state.height
122461
- } : {}),
122511
+ style: _objectSpread({}, this.getRootDimensions()),
122462
122512
  classes: {
122463
122513
  label: isOver && classes.over
122464
122514
  }
@@ -122468,7 +122518,11 @@ const require$$16 = _dll_classnames;
122468
122518
  return BlankContent;
122469
122519
  })(_react["default"].Component);
122470
122520
  exports.BlankContent = BlankContent;
122471
- (0, _defineProperty2["default"])(BlankContent, "propTypes", {
122521
+ BlankContent.defaultProps = {
122522
+ emptyResponseAreaWidth: 0,
122523
+ emptyResponseAreaHeight: 0
122524
+ };
122525
+ BlankContent.propTypes = {
122472
122526
  id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
122473
122527
  disabled: _propTypes["default"].bool,
122474
122528
  duplicates: _propTypes["default"].bool,
@@ -122477,8 +122531,10 @@ const require$$16 = _dll_classnames;
122477
122531
  isOver: _propTypes["default"].bool,
122478
122532
  dragItem: _propTypes["default"].object,
122479
122533
  correct: _propTypes["default"].bool,
122480
- onChange: _propTypes["default"].func
122481
- });
122534
+ onChange: _propTypes["default"].func,
122535
+ emptyResponseAreaWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
122536
+ emptyResponseAreaHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
122537
+ };
122482
122538
  var StyledBlankContent = useStyles(BlankContent);
122483
122539
  var connectedBlankContent = useStyles(function (_ref4) {
122484
122540
  var connectDragSource = _ref4.connectDragSource, connectDropTarget = _ref4.connectDropTarget, props = (0, _objectWithoutProperties2["default"])(_ref4, _excluded);
@@ -122563,6 +122619,27 @@ const require$$9$5 = _dll_prop_types;
122563
122619
  var _choices = _interopRequireDefault(choices);
122564
122620
  var _blank = _interopRequireDefault(blank);
122565
122621
  var _withMask = withMask$1;
122622
+ function ownKeys(object, enumerableOnly) {
122623
+ var keys = Object.keys(object);
122624
+ if (Object.getOwnPropertySymbols) {
122625
+ var symbols = Object.getOwnPropertySymbols(object);
122626
+ (enumerableOnly && (symbols = symbols.filter(function (sym) {
122627
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
122628
+ })), keys.push.apply(keys, symbols));
122629
+ }
122630
+ return keys;
122631
+ }
122632
+ function _objectSpread(target) {
122633
+ for (var i = 1; i < arguments.length; i++) {
122634
+ var source = null != arguments[i] ? arguments[i] : {};
122635
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
122636
+ (0, _defineProperty2["default"])(target, key, source[key]);
122637
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
122638
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
122639
+ });
122640
+ }
122641
+ return target;
122642
+ }
122566
122643
  function _createSuper(Derived) {
122567
122644
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
122568
122645
  return function _createSuperInternal() {
@@ -122591,7 +122668,7 @@ const require$$9$5 = _dll_prop_types;
122591
122668
  return function (node, data, onChange) {
122592
122669
  var dataset = node.data ? node.data.dataset || ({}) : {};
122593
122670
  if (dataset.component === 'blank') {
122594
- var disabled = props.disabled, duplicates = props.duplicates, correctResponse = props.correctResponse, feedback = props.feedback, showCorrectAnswer = props.showCorrectAnswer;
122671
+ var disabled = props.disabled, duplicates = props.duplicates, correctResponse = props.correctResponse, feedback = props.feedback, showCorrectAnswer = props.showCorrectAnswer, emptyResponseAreaWidth = props.emptyResponseAreaWidth, emptyResponseAreaHeight = props.emptyResponseAreaHeight;
122595
122672
  var choiceId = showCorrectAnswer ? correctResponse[dataset.id] : data[dataset.id];
122596
122673
  var choice = choiceId && props.choices.find(function (c) {
122597
122674
  return c.id === choiceId;
@@ -122603,6 +122680,8 @@ const require$$9$5 = _dll_prop_types;
122603
122680
  duplicates: duplicates,
122604
122681
  choice: choice,
122605
122682
  id: dataset.id,
122683
+ emptyResponseAreaWidth: emptyResponseAreaWidth,
122684
+ emptyResponseAreaHeight: emptyResponseAreaHeight,
122606
122685
  onChange: onChange
122607
122686
  });
122608
122687
  }
@@ -122620,12 +122699,17 @@ const require$$9$5 = _dll_prop_types;
122620
122699
  _this = _super.call.apply(_super, [this].concat(args));
122621
122700
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPositionDirection", function (choicePosition) {
122622
122701
  var flexDirection;
122702
+ var justifyContent;
122703
+ var alignItems;
122623
122704
  switch (choicePosition) {
122624
122705
  case 'left':
122625
122706
  flexDirection = 'row';
122707
+ alignItems = 'center';
122626
122708
  break;
122627
122709
  case 'right':
122628
122710
  flexDirection = 'row-reverse';
122711
+ justifyContent = 'flex-end';
122712
+ alignItems = 'center';
122629
122713
  break;
122630
122714
  case 'below':
122631
122715
  flexDirection = 'column-reverse';
@@ -122634,7 +122718,11 @@ const require$$9$5 = _dll_prop_types;
122634
122718
  flexDirection = 'column';
122635
122719
  break;
122636
122720
  }
122637
- return flexDirection;
122721
+ return {
122722
+ flexDirection: flexDirection,
122723
+ justifyContent: justifyContent,
122724
+ alignItems: alignItems
122725
+ };
122638
122726
  });
122639
122727
  return _this;
122640
122728
  }
@@ -122654,12 +122742,12 @@ const require$$9$5 = _dll_prop_types;
122654
122742
  key: "render",
122655
122743
  value: function render() {
122656
122744
  var _this2 = this;
122657
- var _this$props = this.props, markup = _this$props.markup, duplicates = _this$props.duplicates, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange, choicesPosition = _this$props.choicesPosition, choices = _this$props.choices, correctResponse = _this$props.correctResponse, disabled = _this$props.disabled, feedback = _this$props.feedback, showCorrectAnswer = _this$props.showCorrectAnswer;
122745
+ var _this$props = this.props, markup = _this$props.markup, duplicates = _this$props.duplicates, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange, choicesPosition = _this$props.choicesPosition, choices = _this$props.choices, correctResponse = _this$props.correctResponse, disabled = _this$props.disabled, feedback = _this$props.feedback, showCorrectAnswer = _this$props.showCorrectAnswer, emptyResponseAreaWidth = _this$props.emptyResponseAreaWidth, emptyResponseAreaHeight = _this$props.emptyResponseAreaHeight;
122658
122746
  var choicePosition = choicesPosition || 'below';
122659
- var style = {
122747
+ var style = _objectSpread({
122660
122748
  display: 'flex',
122661
- flexDirection: this.getPositionDirection(choicePosition)
122662
- };
122749
+ minWidth: '100px'
122750
+ }, this.getPositionDirection(choicePosition));
122663
122751
  return _react["default"].createElement("div", {
122664
122752
  ref: function ref(_ref) {
122665
122753
  return _ref && (_this2.rootRef = _ref);
@@ -122681,7 +122769,9 @@ const require$$9$5 = _dll_prop_types;
122681
122769
  duplicates: duplicates,
122682
122770
  feedback: feedback,
122683
122771
  correctResponse: correctResponse,
122684
- showCorrectAnswer: showCorrectAnswer
122772
+ showCorrectAnswer: showCorrectAnswer,
122773
+ emptyResponseAreaWidth: emptyResponseAreaWidth,
122774
+ emptyResponseAreaHeight: emptyResponseAreaHeight
122685
122775
  }));
122686
122776
  }
122687
122777
  }]);
@@ -122702,7 +122792,9 @@ const require$$9$5 = _dll_prop_types;
122702
122792
  disabled: _propTypes["default"].bool,
122703
122793
  feedback: _propTypes["default"].object,
122704
122794
  correctResponse: _propTypes["default"].object,
122705
- showCorrectAnswer: _propTypes["default"].bool
122795
+ showCorrectAnswer: _propTypes["default"].bool,
122796
+ emptyResponseAreaWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
122797
+ emptyResponseAreaHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
122706
122798
  });
122707
122799
  })(dragInTheBlank);
122708
122800
  getDefaultExportFromCjs(dragInTheBlank);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "6.20.1-next.0+ff5446dac",
7
+ "version": "6.20.1-next.14+6343d1b00",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "postpublish": "../../scripts/postpublish"
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@material-ui/core": "^3.9.2",
14
14
  "@pie-framework/pie-player-events": "^0.1.0",
15
- "@pie-lib/pie-toolbox": "1.28.0",
15
+ "@pie-lib/pie-toolbox": "1.29.0",
16
16
  "classnames": "^2.2.5",
17
17
  "lodash": "^4.17.10",
18
18
  "prop-types": "^15.6.1",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "author": "",
23
23
  "license": "ISC",
24
- "gitHead": "ff5446dacb8ea3150022128a9dfde6bf77a2bc7c",
24
+ "gitHead": "6343d1b00c5a4a3d88de70ed13a8aa5c1a43002d",
25
25
  "main": "lib/index.js",
26
26
  "module": "src/index.js",
27
27
  "exports": {