@pie-element/explicit-constructed-response 7.3.7-next.25 → 7.3.7-next.27

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": "2.10.0",
11
+ "@pie-lib/pie-toolbox": "2.10.1",
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": "2.10.0",
11
+ "@pie-lib/pie-toolbox": "2.10.1",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15",
14
14
  "type-of": "^2.0.1"
@@ -1,5 +1,5 @@
1
1
  import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.4.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@5.10.5/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@5.11.0/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
1
  import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.4.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@5.10.5/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@5.11.0/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
5
5
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -19166,7 +19166,7 @@ const require$$14$5 = _dll_classnames;
19166
19166
  return {
19167
19167
  spacer: {
19168
19168
  display: 'inline-block',
19169
- width: '1.5em'
19169
+ width: '.75em'
19170
19170
  }
19171
19171
  };
19172
19172
  })(function (props) {
@@ -19193,7 +19193,7 @@ const require$$14$5 = _dll_classnames;
19193
19193
  }
19194
19194
  return null;
19195
19195
  };
19196
- var renderChildren = function renderChildren(layout, value, onChange, rootRenderChildren, parentNode) {
19196
+ var renderChildren = function renderChildren(layout, value, onChange, rootRenderChildren, parentNode, elementType) {
19197
19197
  if (!value) {
19198
19198
  return null;
19199
19199
  }
@@ -19212,7 +19212,7 @@ const require$$14$5 = _dll_classnames;
19212
19212
  var c = rootRenderChildren(n, value, onChange);
19213
19213
  if (c) {
19214
19214
  children.push(c);
19215
- if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== 'td') {
19215
+ if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== 'td' && elementType === 'drag-in-the-blank') {
19216
19216
  children.push(_react["default"].createElement(Spacer, {
19217
19217
  key: ("spacer-").concat(index)
19218
19218
  }));
@@ -19240,9 +19240,14 @@ const require$$14$5 = _dll_classnames;
19240
19240
  }
19241
19241
  } else if (content.length > 0) {
19242
19242
  children.push(content);
19243
+ if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== 'td' && elementType === 'drag-in-the-blank') {
19244
+ children.push(_react["default"].createElement(Spacer, {
19245
+ key: ("spacer-").concat(index)
19246
+ }));
19247
+ }
19243
19248
  }
19244
19249
  } else {
19245
- var subNodes = renderChildren(n, value, onChange, rootRenderChildren, n);
19250
+ var subNodes = renderChildren(n, value, onChange, rootRenderChildren, n, elementType);
19246
19251
  if (n.type === 'p' || n.type === 'paragraph') {
19247
19252
  children.push(_react["default"].createElement(Paragraph, {
19248
19253
  key: key
@@ -19303,8 +19308,8 @@ const require$$14$5 = _dll_classnames;
19303
19308
  (0, _createClass2["default"])(Mask, [{
19304
19309
  key: "render",
19305
19310
  value: function render() {
19306
- var _this$props = this.props, value = _this$props.value, layout = _this$props.layout;
19307
- var children = renderChildren(layout, value, this.handleChange, this.props.renderChildren);
19311
+ var _this$props = this.props, value = _this$props.value, layout = _this$props.layout, elementType = _this$props.elementType;
19312
+ var children = renderChildren(layout, value, this.handleChange, this.props.renderChildren, null, elementType);
19308
19313
  return _react["default"].createElement(MaskContainer, null, children);
19309
19314
  }
19310
19315
  }]);
@@ -19315,7 +19320,8 @@ const require$$14$5 = _dll_classnames;
19315
19320
  renderChildren: _propTypes["default"].func,
19316
19321
  layout: _propTypes["default"].object,
19317
19322
  value: _propTypes["default"].object,
19318
- onChange: _propTypes["default"].func
19323
+ onChange: _propTypes["default"].func,
19324
+ elementType: _propTypes["default"].string
19319
19325
  });
19320
19326
  })(mask);
19321
19327
  getDefaultExportFromCjs(mask);
@@ -19421,9 +19427,10 @@ var withMask = function withMask(type, renderChildren) {
19421
19427
  }, {
19422
19428
  key: "render",
19423
19429
  value: function render() {
19424
- var _this$props = this.props, markup = _this$props.markup, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange;
19430
+ var _this$props = this.props, markup = _this$props.markup, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange, elementType = _this$props.elementType;
19425
19431
  var maskLayout = layout ? layout : buildLayoutFromMarkup(markup, type);
19426
19432
  return _react$2M["default"].createElement(_mask["default"], {
19433
+ elementType: elementType,
19427
19434
  layout: maskLayout,
19428
19435
  value: value,
19429
19436
  onChange: onChange,
@@ -139566,10 +139573,15 @@ const {omit: require$$13$7} = _dll_lodash;
139566
139573
  (0, _createClass2["default"])(UiLayout, [{
139567
139574
  key: "computeStyle",
139568
139575
  value: function computeStyle(fontSizeFactor) {
139569
- var rootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
139570
- return {
139571
- fontSize: ("").concat(rootFontSize * fontSizeFactor, "px")
139576
+ var getFontSize = function getFontSize(element) {
139577
+ return parseFloat(getComputedStyle(element).fontSize);
139572
139578
  };
139579
+ var rootFontSize = getFontSize(document.documentElement);
139580
+ var bodyFontSize = getFontSize(document.body);
139581
+ var effectiveFontSize = Math.max(rootFontSize, bodyFontSize);
139582
+ return fontSizeFactor !== 1 ? {
139583
+ fontSize: ("").concat(effectiveFontSize * fontSizeFactor, "px")
139584
+ } : null;
139573
139585
  }
139574
139586
  }, {
139575
139587
  key: "render",
@@ -139577,11 +139589,12 @@ const {omit: require$$13$7} = _dll_lodash;
139577
139589
  var _this$props = this.props, children = _this$props.children, className = _this$props.className, classes = _this$props.classes, fontSizeFactor = _this$props.fontSizeFactor, rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
139578
139590
  var finalClass = (0, _classnames["default"])(className, classes.extraCSSRules, classes.uiLayoutContainer);
139579
139591
  var restProps = (0, _omit["default"])(rest, 'extraCSSRules');
139592
+ var style = this.computeStyle(fontSizeFactor);
139580
139593
  return _react["default"].createElement("div", (0, _extends2["default"])({
139581
139594
  className: finalClass
139582
- }, restProps, {
139583
- style: this.computeStyle(fontSizeFactor)
139584
- }), children);
139595
+ }, restProps, style && ({
139596
+ style: style
139597
+ })), children);
139585
139598
  }
139586
139599
  }]);
139587
139600
  return UiLayout;
@@ -145387,6 +145400,7 @@ const require$$9$C = _dll_prop_types;
145387
145400
  value: value,
145388
145401
  disabled: disabled
145389
145402
  }), _react["default"].createElement(Masked, {
145403
+ elementType: 'drag-in-the-blank',
145390
145404
  markup: markup,
145391
145405
  layout: layout,
145392
145406
  value: value,
@@ -175509,6 +175523,7 @@ const require$$3$6 = _dll_prop_types;
175509
175523
  return _react["default"].createElement("span", (0, _extends2["default"])({}, attributes, {
175510
175524
  style: {
175511
175525
  display: 'inline-flex',
175526
+ visibility: props.isFocused ? 'hidden' : 'visible',
175512
175527
  minHeight: '55px',
175513
175528
  minWidth: '178px',
175514
175529
  position: 'relative',
@@ -175536,7 +175551,8 @@ const require$$3$6 = _dll_prop_types;
175536
175551
  ExplicitConstructedResponse.propTypes = {
175537
175552
  attributes: _propTypes["default"].object,
175538
175553
  error: _propTypes["default"].any,
175539
- value: _propTypes["default"].string
175554
+ value: _propTypes["default"].string,
175555
+ isFocused: _propTypes["default"].bool
175540
175556
  };
175541
175557
  var _default = ExplicitConstructedResponse;
175542
175558
  exports["default"] = _default;
@@ -175862,7 +175878,7 @@ const {isUndefined: require$$3$4} = _dll_lodash;
175862
175878
  onChange(change);
175863
175879
  },
175864
175880
  renderNode: function renderNode(props) {
175865
- var attributes = props.attributes, n = props.node;
175881
+ var attributes = props.attributes, n = props.node, isFocused = props.isFocused;
175866
175882
  if (n.type === 'explicit_constructed_response') {
175867
175883
  var data = n.data.toJSON();
175868
175884
  var error;
@@ -175871,6 +175887,7 @@ const {isUndefined: require$$3$4} = _dll_lodash;
175871
175887
  }
175872
175888
  return _react["default"].createElement(_explicitConstructedResponse["default"], {
175873
175889
  attributes: attributes,
175890
+ isFocused: isFocused,
175874
175891
  value: data.value,
175875
175892
  error: error && error[data.index] && error[data.index][0]
175876
175893
  });
@@ -180292,6 +180309,11 @@ const require$$21 = _dll_debug;
180292
180309
  },
180293
180310
  '& table:not([border="1"]) td, th': {
180294
180311
  border: '1px solid #dfe2e5'
180312
+ },
180313
+ '& > div::after': {
180314
+ display: 'block',
180315
+ content: '"¶"',
180316
+ color: '#146EB3'
180295
180317
  }
180296
180318
  },
180297
180319
  toolbarOnTop: {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "5.10.5"
11
+ "version": "5.11.0"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.4.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@5.10.5/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@5.11.0/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
5
5
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -19129,7 +19129,7 @@ const require$$14$5 = _dll_classnames;
19129
19129
  return {
19130
19130
  spacer: {
19131
19131
  display: 'inline-block',
19132
- width: '1.5em'
19132
+ width: '.75em'
19133
19133
  }
19134
19134
  };
19135
19135
  })(function (props) {
@@ -19156,7 +19156,7 @@ const require$$14$5 = _dll_classnames;
19156
19156
  }
19157
19157
  return null;
19158
19158
  };
19159
- var renderChildren = function renderChildren(layout, value, onChange, rootRenderChildren, parentNode) {
19159
+ var renderChildren = function renderChildren(layout, value, onChange, rootRenderChildren, parentNode, elementType) {
19160
19160
  if (!value) {
19161
19161
  return null;
19162
19162
  }
@@ -19175,7 +19175,7 @@ const require$$14$5 = _dll_classnames;
19175
19175
  var c = rootRenderChildren(n, value, onChange);
19176
19176
  if (c) {
19177
19177
  children.push(c);
19178
- if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== 'td') {
19178
+ if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== 'td' && elementType === 'drag-in-the-blank') {
19179
19179
  children.push(_react["default"].createElement(Spacer, {
19180
19180
  key: ("spacer-").concat(index)
19181
19181
  }));
@@ -19203,9 +19203,14 @@ const require$$14$5 = _dll_classnames;
19203
19203
  }
19204
19204
  } else if (content.length > 0) {
19205
19205
  children.push(content);
19206
+ if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== 'td' && elementType === 'drag-in-the-blank') {
19207
+ children.push(_react["default"].createElement(Spacer, {
19208
+ key: ("spacer-").concat(index)
19209
+ }));
19210
+ }
19206
19211
  }
19207
19212
  } else {
19208
- var subNodes = renderChildren(n, value, onChange, rootRenderChildren, n);
19213
+ var subNodes = renderChildren(n, value, onChange, rootRenderChildren, n, elementType);
19209
19214
  if (n.type === 'p' || n.type === 'paragraph') {
19210
19215
  children.push(_react["default"].createElement(Paragraph, {
19211
19216
  key: key
@@ -19266,8 +19271,8 @@ const require$$14$5 = _dll_classnames;
19266
19271
  (0, _createClass2["default"])(Mask, [{
19267
19272
  key: "render",
19268
19273
  value: function render() {
19269
- var _this$props = this.props, value = _this$props.value, layout = _this$props.layout;
19270
- var children = renderChildren(layout, value, this.handleChange, this.props.renderChildren);
19274
+ var _this$props = this.props, value = _this$props.value, layout = _this$props.layout, elementType = _this$props.elementType;
19275
+ var children = renderChildren(layout, value, this.handleChange, this.props.renderChildren, null, elementType);
19271
19276
  return _react["default"].createElement(MaskContainer, null, children);
19272
19277
  }
19273
19278
  }]);
@@ -19278,7 +19283,8 @@ const require$$14$5 = _dll_classnames;
19278
19283
  renderChildren: _propTypes["default"].func,
19279
19284
  layout: _propTypes["default"].object,
19280
19285
  value: _propTypes["default"].object,
19281
- onChange: _propTypes["default"].func
19286
+ onChange: _propTypes["default"].func,
19287
+ elementType: _propTypes["default"].string
19282
19288
  });
19283
19289
  })(mask);
19284
19290
  getDefaultExportFromCjs(mask);
@@ -19384,9 +19390,10 @@ var withMask = function withMask(type, renderChildren) {
19384
19390
  }, {
19385
19391
  key: "render",
19386
19392
  value: function render() {
19387
- var _this$props = this.props, markup = _this$props.markup, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange;
19393
+ var _this$props = this.props, markup = _this$props.markup, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange, elementType = _this$props.elementType;
19388
19394
  var maskLayout = layout ? layout : buildLayoutFromMarkup(markup, type);
19389
19395
  return _react$2M["default"].createElement(_mask["default"], {
19396
+ elementType: elementType,
19390
19397
  layout: maskLayout,
19391
19398
  value: value,
19392
19399
  onChange: onChange,
@@ -139529,10 +139536,15 @@ const {omit: require$$13$7} = _dll_lodash;
139529
139536
  (0, _createClass2["default"])(UiLayout, [{
139530
139537
  key: "computeStyle",
139531
139538
  value: function computeStyle(fontSizeFactor) {
139532
- var rootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
139533
- return {
139534
- fontSize: ("").concat(rootFontSize * fontSizeFactor, "px")
139539
+ var getFontSize = function getFontSize(element) {
139540
+ return parseFloat(getComputedStyle(element).fontSize);
139535
139541
  };
139542
+ var rootFontSize = getFontSize(document.documentElement);
139543
+ var bodyFontSize = getFontSize(document.body);
139544
+ var effectiveFontSize = Math.max(rootFontSize, bodyFontSize);
139545
+ return fontSizeFactor !== 1 ? {
139546
+ fontSize: ("").concat(effectiveFontSize * fontSizeFactor, "px")
139547
+ } : null;
139536
139548
  }
139537
139549
  }, {
139538
139550
  key: "render",
@@ -139540,11 +139552,12 @@ const {omit: require$$13$7} = _dll_lodash;
139540
139552
  var _this$props = this.props, children = _this$props.children, className = _this$props.className, classes = _this$props.classes, fontSizeFactor = _this$props.fontSizeFactor, rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
139541
139553
  var finalClass = (0, _classnames["default"])(className, classes.extraCSSRules, classes.uiLayoutContainer);
139542
139554
  var restProps = (0, _omit["default"])(rest, 'extraCSSRules');
139555
+ var style = this.computeStyle(fontSizeFactor);
139543
139556
  return _react["default"].createElement("div", (0, _extends2["default"])({
139544
139557
  className: finalClass
139545
- }, restProps, {
139546
- style: this.computeStyle(fontSizeFactor)
139547
- }), children);
139558
+ }, restProps, style && ({
139559
+ style: style
139560
+ })), children);
139548
139561
  }
139549
139562
  }]);
139550
139563
  return UiLayout;
@@ -145350,6 +145363,7 @@ const require$$9$C = _dll_prop_types;
145350
145363
  value: value,
145351
145364
  disabled: disabled
145352
145365
  }), _react["default"].createElement(Masked, {
145366
+ elementType: 'drag-in-the-blank',
145353
145367
  markup: markup,
145354
145368
  layout: layout,
145355
145369
  value: value,
@@ -175472,6 +175486,7 @@ const require$$3$6 = _dll_prop_types;
175472
175486
  return _react["default"].createElement("span", (0, _extends2["default"])({}, attributes, {
175473
175487
  style: {
175474
175488
  display: 'inline-flex',
175489
+ visibility: props.isFocused ? 'hidden' : 'visible',
175475
175490
  minHeight: '55px',
175476
175491
  minWidth: '178px',
175477
175492
  position: 'relative',
@@ -175499,7 +175514,8 @@ const require$$3$6 = _dll_prop_types;
175499
175514
  ExplicitConstructedResponse.propTypes = {
175500
175515
  attributes: _propTypes["default"].object,
175501
175516
  error: _propTypes["default"].any,
175502
- value: _propTypes["default"].string
175517
+ value: _propTypes["default"].string,
175518
+ isFocused: _propTypes["default"].bool
175503
175519
  };
175504
175520
  var _default = ExplicitConstructedResponse;
175505
175521
  exports["default"] = _default;
@@ -175825,7 +175841,7 @@ const {isUndefined: require$$3$4} = _dll_lodash;
175825
175841
  onChange(change);
175826
175842
  },
175827
175843
  renderNode: function renderNode(props) {
175828
- var attributes = props.attributes, n = props.node;
175844
+ var attributes = props.attributes, n = props.node, isFocused = props.isFocused;
175829
175845
  if (n.type === 'explicit_constructed_response') {
175830
175846
  var data = n.data.toJSON();
175831
175847
  var error;
@@ -175834,6 +175850,7 @@ const {isUndefined: require$$3$4} = _dll_lodash;
175834
175850
  }
175835
175851
  return _react["default"].createElement(_explicitConstructedResponse["default"], {
175836
175852
  attributes: attributes,
175853
+ isFocused: isFocused,
175837
175854
  value: data.value,
175838
175855
  error: error && error[data.index] && error[data.index][0]
175839
175856
  });
@@ -180255,6 +180272,11 @@ const require$$21 = _dll_debug;
180255
180272
  },
180256
180273
  '& table:not([border="1"]) td, th': {
180257
180274
  border: '1px solid #dfe2e5'
180275
+ },
180276
+ '& > div::after': {
180277
+ display: 'block',
180278
+ content: '"¶"',
180279
+ color: '#146EB3'
180258
180280
  }
180259
180281
  },
180260
180282
  toolbarOnTop: {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "7.3.7-next.25+64c74d469",
7
+ "version": "7.3.7-next.27+622eab7fb",
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": "2.10.0",
15
+ "@pie-lib/pie-toolbox": "2.10.1",
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": "64c74d4694830e13d60d51e0bcacd38b309ccc6d",
24
+ "gitHead": "622eab7fb4903086040bebc83387e8628da1846e",
25
25
  "main": "lib/index.js",
26
26
  "module": "src/index.js",
27
27
  "exports": {