@pie-element/complex-rubric 2.10.1-next.1 → 2.10.1-next.11

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.
Files changed (121) hide show
  1. package/configure/lib/defaults.js +216 -0
  2. package/configure/lib/defaults.js.map +1 -0
  3. package/configure/lib/index.js +241 -0
  4. package/configure/lib/index.js.map +1 -0
  5. package/configure/lib/main.js +221 -0
  6. package/configure/lib/main.js.map +1 -0
  7. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +1 -0
  8. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +1383 -0
  9. package/configure/node_modules/@pie-element/multi-trait-rubric/LICENSE.md +5 -0
  10. package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +55 -0
  11. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +1 -0
  12. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +1270 -0
  13. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +584 -0
  14. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +1 -0
  15. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +143 -0
  16. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +1 -0
  17. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +204 -0
  18. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +1 -0
  19. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +602 -0
  20. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +1 -0
  21. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +361 -0
  22. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +1 -0
  23. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +556 -0
  24. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +1 -0
  25. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +380 -0
  26. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +1 -0
  27. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +296 -0
  28. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +1 -0
  29. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +14 -0
  30. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +1 -0
  31. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +18 -0
  32. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +1 -0
  33. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +544 -0
  34. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +94 -0
  35. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +1 -0
  36. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +215 -0
  37. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +1 -0
  38. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js +13 -0
  39. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js.map +1 -0
  40. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +15 -0
  41. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +803 -0
  42. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +602 -0
  43. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +8 -0
  44. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +180 -0
  45. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +1 -0
  46. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +6 -0
  47. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +531 -0
  48. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +374 -0
  49. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +85 -0
  50. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +1 -0
  51. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +161 -0
  52. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +1 -0
  53. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +330 -0
  54. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +1 -0
  55. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +103 -0
  56. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +1 -0
  57. package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +24 -0
  58. package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +257 -0
  59. package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +1640 -0
  60. package/configure/node_modules/@pie-element/rubric/LICENSE.md +5 -0
  61. package/configure/node_modules/@pie-element/rubric/README.md +3 -0
  62. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +197 -0
  63. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +1471 -0
  64. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +59 -0
  65. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +1 -0
  66. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +194 -0
  67. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +1 -0
  68. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +160 -0
  69. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +1 -0
  70. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js +555 -0
  71. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js.map +1 -0
  72. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js +24 -0
  73. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js.map +1 -0
  74. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js +172 -0
  75. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js.map +1 -0
  76. package/configure/node_modules/@pie-element/rubric/configure/package.json +17 -0
  77. package/configure/node_modules/@pie-element/rubric/configure/src/__tests__/index.test.jsx +173 -0
  78. package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +39 -0
  79. package/configure/node_modules/@pie-element/rubric/configure/src/index.js +127 -0
  80. package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +87 -0
  81. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/authoring.jsx +427 -0
  82. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/index.js +9 -0
  83. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/point-menu.jsx +94 -0
  84. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +17 -0
  85. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +536 -0
  86. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +51 -0
  87. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +1 -0
  88. package/configure/node_modules/@pie-element/rubric/controller/package.json +13 -0
  89. package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +31 -0
  90. package/configure/node_modules/@pie-element/rubric/controller/src/index.js +42 -0
  91. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +382 -0
  92. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +292 -0
  93. package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +8 -0
  94. package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +8 -0
  95. package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +2 -0
  96. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +226 -0
  97. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +161 -0
  98. package/configure/node_modules/@pie-element/rubric/lib/index.js +88 -0
  99. package/configure/node_modules/@pie-element/rubric/lib/index.js.map +1 -0
  100. package/configure/node_modules/@pie-element/rubric/lib/main.js +187 -0
  101. package/configure/node_modules/@pie-element/rubric/lib/main.js.map +1 -0
  102. package/configure/node_modules/@pie-element/rubric/lib/print.js +114 -0
  103. package/configure/node_modules/@pie-element/rubric/lib/print.js.map +1 -0
  104. package/configure/node_modules/@pie-element/rubric/package.json +26 -0
  105. package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +23003 -0
  106. package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +50 -0
  107. package/configure/node_modules/@pie-element/rubric/src/index.js +34 -0
  108. package/configure/node_modules/@pie-element/rubric/src/main.jsx +136 -0
  109. package/configure/node_modules/@pie-element/rubric/src/print.js +63 -0
  110. package/configure/package.json +2 -2
  111. package/controller/lib/defaults.js +134 -0
  112. package/controller/lib/defaults.js.map +1 -0
  113. package/controller/lib/index.js +307 -0
  114. package/controller/lib/index.js.map +1 -0
  115. package/controller/lib/utils.js +13 -0
  116. package/controller/lib/utils.js.map +1 -0
  117. package/lib/index.js +232 -0
  118. package/lib/index.js.map +1 -0
  119. package/lib/print.js +201 -0
  120. package/lib/print.js.map +1 -0
  121. package/package.json +4 -4
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ model: {
9
+ points: ['', '', '', ''],
10
+ sampleAnswers: [null, null, null, null],
11
+ maxPoints: 3,
12
+ excludeZero: false,
13
+ excludeZeroEnabled: true,
14
+ maxPointsEnabled: true
15
+ },
16
+ configuration: {
17
+ baseInputConfiguration: {
18
+ audio: {
19
+ disabled: false
20
+ },
21
+ video: {
22
+ disabled: false
23
+ },
24
+ image: {
25
+ disabled: false
26
+ }
27
+ },
28
+ rubriclessInstruction: {
29
+ inputConfiguration: {
30
+ audio: {
31
+ disabled: false
32
+ },
33
+ video: {
34
+ disabled: false
35
+ },
36
+ image: {
37
+ disabled: false
38
+ }
39
+ }
40
+ },
41
+ showExcludeZero: {
42
+ settings: true,
43
+ label: 'Ability to exclude zero'
44
+ },
45
+ showMaxPoint: {
46
+ settings: true,
47
+ label: 'Show max points dropdown'
48
+ },
49
+ settingsPanelDisabled: false,
50
+ // width: '500px'
51
+ mathMlOptions: {
52
+ mmlOutput: false,
53
+ mmlEditing: false
54
+ },
55
+ maxMaxPoints: 9
56
+ }
57
+ };
58
+ exports["default"] = _default;
59
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["model","points","sampleAnswers","maxPoints","excludeZero","excludeZeroEnabled","maxPointsEnabled","configuration","baseInputConfiguration","audio","disabled","video","image","rubriclessInstruction","inputConfiguration","showExcludeZero","settings","label","showMaxPoint","settingsPanelDisabled","mathMlOptions","mmlOutput","mmlEditing","maxMaxPoints"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,EAAa,EAAb,CADH;AAELC,IAAAA,aAAa,EAAE,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAFV;AAGLC,IAAAA,SAAS,EAAE,CAHN;AAILC,IAAAA,WAAW,EAAE,KAJR;AAKLC,IAAAA,kBAAkB,EAAE,IALf;AAMLC,IAAAA,gBAAgB,EAAE;AANb,GADM;AASbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,sBAAsB,EAAE;AACtBC,MAAAA,KAAK,EAAE;AAAEC,QAAAA,QAAQ,EAAE;AAAZ,OADe;AAEtBC,MAAAA,KAAK,EAAE;AAAED,QAAAA,QAAQ,EAAE;AAAZ,OAFe;AAGtBE,MAAAA,KAAK,EAAE;AAAEF,QAAAA,QAAQ,EAAE;AAAZ;AAHe,KADX;AAMbG,IAAAA,qBAAqB,EAAE;AACrBC,MAAAA,kBAAkB,EAAE;AAClBL,QAAAA,KAAK,EAAE;AAAEC,UAAAA,QAAQ,EAAE;AAAZ,SADW;AAElBC,QAAAA,KAAK,EAAE;AAAED,UAAAA,QAAQ,EAAE;AAAZ,SAFW;AAGlBE,QAAAA,KAAK,EAAE;AAAEF,UAAAA,QAAQ,EAAE;AAAZ;AAHW;AADC,KANV;AAabK,IAAAA,eAAe,EAAE;AACfC,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KAbJ;AAiBbC,IAAAA,YAAY,EAAE;AACZF,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE;AAFK,KAjBD;AAqBbE,IAAAA,qBAAqB,EAAE,KArBV;AAsBb;AACAC,IAAAA,aAAa,EAAE;AACbC,MAAAA,SAAS,EAAE,KADE;AAEbC,MAAAA,UAAU,EAAE;AAFC,KAvBF;AA2BbC,IAAAA,YAAY,EAAE;AA3BD;AATF,C","sourcesContent":["export default {\n model: {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints: 3,\n excludeZero: false,\n excludeZeroEnabled: true,\n maxPointsEnabled: true,\n },\n configuration: {\n baseInputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n rubriclessInstruction: {\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n showExcludeZero: {\n settings: true,\n label: 'Ability to exclude zero',\n },\n showMaxPoint: {\n settings: true,\n label: 'Show max points dropdown',\n },\n settingsPanelDisabled: false,\n // width: '500px'\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n maxMaxPoints: 9,\n },\n};\n"],"file":"defaults.js"}
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
+
18
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
+
24
+ var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
25
+
26
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
+
28
+ var _pieConfigureEvents = require("@pie-framework/pie-configure-events");
29
+
30
+ var _react = _interopRequireDefault(require("react"));
31
+
32
+ var _reactDom = _interopRequireDefault(require("react-dom"));
33
+
34
+ var _debug = _interopRequireDefault(require("debug"));
35
+
36
+ var _main = _interopRequireDefault(require("./main"));
37
+
38
+ var _defaults = _interopRequireDefault(require("./defaults"));
39
+
40
+ 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); }; }
41
+
42
+ 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; } }
43
+
44
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
45
+
46
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
47
+
48
+ var modelWithDefaults = function modelWithDefaults(m) {
49
+ return _objectSpread(_objectSpread({}, _defaults["default"].model), m);
50
+ };
51
+
52
+ var configurationWithDefaults = function configurationWithDefaults(c) {
53
+ return _objectSpread(_objectSpread({}, _defaults["default"].configuration), c);
54
+ };
55
+
56
+ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
57
+ (0, _inherits2["default"])(RubricElement, _HTMLElement);
58
+
59
+ var _super = _createSuper(RubricElement);
60
+
61
+ function RubricElement() {
62
+ var _this;
63
+
64
+ (0, _classCallCheck2["default"])(this, RubricElement);
65
+ _this = _super.call(this);
66
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateModelAccordingToReceivedProps", function (nextModel) {
67
+ var currentModel = _objectSpread({}, _this._model);
68
+
69
+ if (!nextModel) {
70
+ return currentModel;
71
+ }
72
+
73
+ var validatedModel = nextModel;
74
+
75
+ var _ref = validatedModel || {},
76
+ maxPoints = _ref.maxPoints,
77
+ excludeZero = _ref.excludeZero;
78
+
79
+ validatedModel.points = validatedModel.points ? (0, _toConsumableArray2["default"])(validatedModel.points) : [];
80
+ validatedModel.sampleAnswers = validatedModel.sampleAnswers ? (0, _toConsumableArray2["default"])(validatedModel.sampleAnswers) : [];
81
+ var howManyPointsShouldHave = excludeZero ? maxPoints : maxPoints + 1;
82
+ var howManyPointsDoesItHave = validatedModel.points.length;
83
+ var excludeZeroChanged = (currentModel === null || currentModel === void 0 ? void 0 : currentModel.excludeZero) !== (nextModel === null || nextModel === void 0 ? void 0 : nextModel.excludeZero);
84
+ var maxPointsChanged = (currentModel === null || currentModel === void 0 ? void 0 : currentModel.maxPoints) !== (nextModel === null || nextModel === void 0 ? void 0 : nextModel.maxPoints);
85
+
86
+ if (howManyPointsDoesItHave < howManyPointsShouldHave) {
87
+ if (excludeZeroChanged && !excludeZero) {
88
+ validatedModel.points = [''].concat((0, _toConsumableArray2["default"])(validatedModel.points));
89
+ validatedModel.sampleAnswers = [null].concat((0, _toConsumableArray2["default"])(validatedModel.sampleAnswers));
90
+ }
91
+
92
+ if (maxPointsChanged) {
93
+ for (var i = 0; i < howManyPointsShouldHave - howManyPointsDoesItHave; i++) {
94
+ validatedModel.points.push('');
95
+ validatedModel.sampleAnswers.push(null);
96
+ }
97
+ }
98
+ } else if (howManyPointsDoesItHave > howManyPointsShouldHave) {
99
+ if (excludeZeroChanged && excludeZero) {
100
+ validatedModel.points = validatedModel.points.slice(1);
101
+ validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(1);
102
+ }
103
+
104
+ if (maxPointsChanged) {
105
+ validatedModel.points = validatedModel.points.slice(0, howManyPointsShouldHave);
106
+ validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(0, howManyPointsShouldHave);
107
+ }
108
+ }
109
+
110
+ return validatedModel;
111
+ });
112
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onConfigurationChanged", function (c) {
113
+ _this._configuration = configurationWithDefaults(c);
114
+
115
+ if (_this._model) {
116
+ _this.onModelChanged(_this._model);
117
+ }
118
+
119
+ _this._render();
120
+ });
121
+
122
+ _debug["default"].log('constructor called');
123
+
124
+ _this._model = modelWithDefaults();
125
+ _this._configuration = configurationWithDefaults();
126
+ _this.onModelChanged = _this.onModelChanged.bind((0, _assertThisInitialized2["default"])(_this));
127
+ _this.onConfigurationChanged = _this.onConfigurationChanged.bind((0, _assertThisInitialized2["default"])(_this));
128
+ return _this;
129
+ }
130
+
131
+ (0, _createClass2["default"])(RubricElement, [{
132
+ key: "model",
133
+ set: function set(m) {
134
+ this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
135
+
136
+ this._render();
137
+ }
138
+ }, {
139
+ key: "configuration",
140
+ set: function set(c) {
141
+ this._configuration = configurationWithDefaults(c);
142
+
143
+ this._render();
144
+ }
145
+ }, {
146
+ key: "onModelChanged",
147
+ value: function onModelChanged(m) {
148
+ this._model = this.updateModelAccordingToReceivedProps(m);
149
+
150
+ this._render();
151
+
152
+ this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model, false));
153
+ }
154
+ }, {
155
+ key: "insertImage",
156
+ value: function insertImage(handler) {
157
+ this.dispatchEvent(new _pieConfigureEvents.InsertImageEvent(handler));
158
+ }
159
+ }, {
160
+ key: "onDeleteImage",
161
+ value: function onDeleteImage(src, done) {
162
+ this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
163
+ }
164
+ }, {
165
+ key: "connectedCallback",
166
+ value: function connectedCallback() {
167
+ this._render();
168
+ }
169
+ }, {
170
+ key: "_render",
171
+ value: function _render() {
172
+ console.log('THE MODEL', this._model);
173
+
174
+ if (this._model) {
175
+ var element = /*#__PURE__*/_react["default"].createElement(_main["default"], {
176
+ model: this._model,
177
+ configuration: this._configuration,
178
+ onModelChanged: this.onModelChanged,
179
+ onConfigurationChanged: this.onConfigurationChanged,
180
+ imageSupport: {
181
+ add: this.insertImage.bind(this),
182
+ "delete": this.onDeleteImage.bind(this)
183
+ }
184
+ });
185
+
186
+ _reactDom["default"].render(element, this);
187
+ }
188
+ }
189
+ }]);
190
+ return RubricElement;
191
+ }( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
192
+
193
+ exports["default"] = RubricElement;
194
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.js"],"names":["modelWithDefaults","m","defaults","model","configurationWithDefaults","c","configuration","RubricElement","nextModel","currentModel","_model","validatedModel","maxPoints","excludeZero","points","sampleAnswers","howManyPointsShouldHave","howManyPointsDoesItHave","length","excludeZeroChanged","maxPointsChanged","i","push","slice","_configuration","onModelChanged","_render","debug","log","bind","onConfigurationChanged","updateModelAccordingToReceivedProps","dispatchEvent","ModelUpdatedEvent","handler","InsertImageEvent","src","done","DeleteImageEvent","console","element","React","createElement","Main","imageSupport","add","insertImage","onDeleteImage","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,CAAD;AAAA,yCAAYC,qBAASC,KAArB,GAA+BF,CAA/B;AAAA,CAA1B;;AACA,IAAMG,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACC,CAAD;AAAA,yCAAYH,qBAASI,aAArB,GAAuCD,CAAvC;AAAA,CAAlC;;IAEqBE,a;;;;;AAGjB,2BAAc;AAAA;;AAAA;AACV;AADU,4HASwB,UAACC,SAAD,EAAe;AACjD,UAAMC,YAAY,qBAAO,MAAKC,MAAZ,CAAlB;;AACA,UAAI,CAACF,SAAL,EAAgB;AACZ,eAAOC,YAAP;AACH;;AAED,UAAME,cAAc,GAAGH,SAAvB;;AACA,iBAAmCG,cAAc,IAAI,EAArD;AAAA,UAAQC,SAAR,QAAQA,SAAR;AAAA,UAAmBC,WAAnB,QAAmBA,WAAnB;;AAEAF,MA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,CAAD,CAA/C;;AACA,WAAKqB,OAAL;AACH;;;WAED,wBAAezB,CAAf,EAAkB;AACd,WAAKS,MAAL,GAAc,KAAKqB,mCAAL,CAAyC9B,CAAzC,CAAd;;AACA,WAAKyB,OAAL;;AACA,WAAKM,aAAL,CAAmB,IAAIC,qCAAJ,CAAsB,KAAKvB,MAA3B,EAAmC,KAAnC,CAAnB;AACH;;;WAYD,qBAAYwB,OAAZ,EAAqB;AACjB,WAAKF,aAAL,CAAmB,IAAIG,oCAAJ,CAAqBD,OAArB,CAAnB;AACH;;;WAED,uBAAcE,GAAd,EAAmBC,IAAnB,EAAyB;AACrB,WAAKL,aAAL,CAAmB,IAAIM,oCAAJ,CAAqBF,GAArB,EAA0BC,IAA1B,CAAnB;AACH;;;WAED,6BAAoB;AAChB,WAAKX,OAAL;AACH;;;WAED,mBAAU;AACNa,MAAAA,OAAO,CAACX,GAAR,CAAY,WAAZ,EAAyB,KAAKlB,MAA9B;;AACA,UAAI,KAAKA,MAAT,EAAiB;AACb,YAAI8B,OAAO,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACpCxC,UAAAA,KAAK,EAAE,KAAKO,MADwB;AAEpCJ,UAAAA,aAAa,EAAE,KAAKkB,cAFgB;AAGpCC,UAAAA,cAAc,EAAE,KAAKA,cAHe;AAIpCK,UAAAA,sBAAsB,EAAE,KAAKA,sBAJO;AAKpCc,UAAAA,YAAY,EAAE;AACVC,YAAAA,GAAG,EAAE,KAAKC,WAAL,CAAiBjB,IAAjB,CAAsB,IAAtB,CADK;AAEV,sBAAQ,KAAKkB,aAAL,CAAmBlB,IAAnB,CAAwB,IAAxB;AAFE;AALsB,SAA1B,CAAd;;AAWAmB,6BAASC,MAAT,CAAgBT,OAAhB,EAAyB,IAAzB;AACH;AACJ;;;kDA9GsCU,W","sourcesContent":["import {\n ModelUpdatedEvent,\n InsertImageEvent,\n DeleteImageEvent\n} from '@pie-framework/pie-configure-events';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\n\nimport Main from './main';\nimport defaults from './defaults';\n\nconst modelWithDefaults = (m) => ({...defaults.model, ...m});\nconst configurationWithDefaults = (c) => ({...defaults.configuration, ...c});\n\nexport default class RubricElement extends HTMLElement {\n\n\n constructor() {\n super();\n debug.log('constructor called');\n this._model = modelWithDefaults();\n this._configuration = configurationWithDefaults();\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n updateModelAccordingToReceivedProps = (nextModel) => {\n const currentModel = {...this._model};\n if (!nextModel) {\n return currentModel;\n }\n\n const validatedModel = nextModel;\n const { maxPoints, excludeZero } = validatedModel || {};\n\n validatedModel.points = validatedModel.points ? [...validatedModel.points] : [];\n validatedModel.sampleAnswers = validatedModel.sampleAnswers ? [...validatedModel.sampleAnswers] : [];\n\n const howManyPointsShouldHave = excludeZero ? maxPoints : maxPoints + 1;\n const howManyPointsDoesItHave = validatedModel.points.length;\n\n const excludeZeroChanged = currentModel?.excludeZero !== nextModel?.excludeZero;\n const maxPointsChanged = currentModel?.maxPoints !== nextModel?.maxPoints;\n\n if (howManyPointsDoesItHave < howManyPointsShouldHave) {\n if (excludeZeroChanged && !excludeZero) {\n validatedModel.points = ['', ...validatedModel.points];\n validatedModel.sampleAnswers = [null, ...validatedModel.sampleAnswers];\n }\n if (maxPointsChanged) {\n for (let i = 0; i < howManyPointsShouldHave - howManyPointsDoesItHave; i++) {\n validatedModel.points.push('');\n validatedModel.sampleAnswers.push(null);\n }\n }\n } \n else if (howManyPointsDoesItHave > howManyPointsShouldHave) {\n if (excludeZeroChanged && excludeZero) {\n validatedModel.points = validatedModel.points.slice(1);\n validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(1);\n }\n if (maxPointsChanged) {\n validatedModel.points = validatedModel.points.slice(0, howManyPointsShouldHave);\n validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(0, howManyPointsShouldHave);\n }\n }\n\n return validatedModel;\n }\n\n set model(m) {\n this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));\n this._render();\n }\n\n set configuration(c) {\n this._configuration = configurationWithDefaults(c);\n this._render();\n }\n\n onModelChanged(m) {\n this._model = this.updateModelAccordingToReceivedProps(m);\n this._render();\n this.dispatchEvent(new ModelUpdatedEvent(this._model, false));\n }\n\n onConfigurationChanged = (c) => {\n this._configuration = configurationWithDefaults(c);\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n };\n\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n console.log('THE MODEL', this._model);\n if (this._model) {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n });\n\n ReactDOM.render(element, this);\n }\n }\n}\n"],"file":"index.js"}
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
+
18
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
+
24
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
+
26
+ var _react = _interopRequireDefault(require("react"));
27
+
28
+ var _index = require("./pie-toolbox-rubric/index");
29
+
30
+ var _styles = require("@material-ui/core/styles");
31
+
32
+ var _configUi = require("@pie-lib/pie-toolbox/config-ui");
33
+
34
+ var _excluded = ["points", "sampleAnswers"];
35
+
36
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
+
38
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
39
+
40
+ 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); }; }
41
+
42
+ 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; } }
43
+
44
+ var Panel = _configUi.settings.Panel,
45
+ toggle = _configUi.settings.toggle;
46
+
47
+ var styles = function styles(theme) {
48
+ return {
49
+ design: {
50
+ fontFamily: 'Cerebri Sans',
51
+ fontSize: theme.typography.fontSize
52
+ }
53
+ };
54
+ };
55
+
56
+ var Main = /*#__PURE__*/function (_React$Component) {
57
+ (0, _inherits2["default"])(Main, _React$Component);
58
+
59
+ var _super = _createSuper(Main);
60
+
61
+ function Main() {
62
+ var _this;
63
+
64
+ (0, _classCallCheck2["default"])(this, Main);
65
+
66
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
67
+ args[_key] = arguments[_key];
68
+ }
69
+
70
+ _this = _super.call.apply(_super, [this].concat(args));
71
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "verifyRubriclessModel", function (m, config) {
72
+ var _ref = config || {},
73
+ _ref$rubricless = _ref.rubricless,
74
+ rubricless = _ref$rubricless === void 0 ? false : _ref$rubricless;
75
+
76
+ return rubricless ? function (_ref2) {
77
+ var points = _ref2.points,
78
+ sampleAnswers = _ref2.sampleAnswers,
79
+ rest = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
80
+ return rest;
81
+ }(m) : m;
82
+ });
83
+ return _this;
84
+ }
85
+
86
+ (0, _createClass2["default"])(Main, [{
87
+ key: "render",
88
+ value: function render() {
89
+ var _ref3 = this.props || {},
90
+ model = _ref3.model,
91
+ configuration = _ref3.configuration,
92
+ onConfigurationChanged = _ref3.onConfigurationChanged,
93
+ onModelChanged = _ref3.onModelChanged,
94
+ imageSupport = _ref3.imageSupport;
95
+
96
+ var _ref4 = configuration || {},
97
+ _ref4$baseInputConfig = _ref4.baseInputConfiguration,
98
+ baseInputConfiguration = _ref4$baseInputConfig === void 0 ? {} : _ref4$baseInputConfig,
99
+ _ref4$contentDimensio = _ref4.contentDimensions,
100
+ contentDimensions = _ref4$contentDimensio === void 0 ? {} : _ref4$contentDimensio,
101
+ settingsPanelDisabled = _ref4.settingsPanelDisabled,
102
+ _ref4$showExcludeZero = _ref4.showExcludeZero,
103
+ showExcludeZero = _ref4$showExcludeZero === void 0 ? {} : _ref4$showExcludeZero,
104
+ _ref4$showMaxPoint = _ref4.showMaxPoint,
105
+ showMaxPoint = _ref4$showMaxPoint === void 0 ? {} : _ref4$showMaxPoint,
106
+ _ref4$mathMlOptions = _ref4.mathMlOptions,
107
+ mathMlOptions = _ref4$mathMlOptions === void 0 ? {} : _ref4$mathMlOptions,
108
+ _ref4$rubricless = _ref4.rubricless,
109
+ rubricless = _ref4$rubricless === void 0 ? false : _ref4$rubricless,
110
+ rubriclessInstruction = _ref4.rubriclessInstruction,
111
+ width = _ref4.width; // ensure to eliminate points and sampleAnswers in case of rubricless
112
+
113
+
114
+ var value = this.verifyRubriclessModel(model, configuration);
115
+ var panelProperties = {
116
+ excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),
117
+ maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
118
+ rubriclessInstructionEnabled: rubricless && rubriclessInstruction.settings && toggle(rubriclessInstruction.label)
119
+ };
120
+
121
+ var getPluginProps = function getPluginProps(props) {
122
+ return Object.assign(_objectSpread({}, baseInputConfiguration), props || {});
123
+ };
124
+
125
+ return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
126
+ dimensions: contentDimensions,
127
+ hideSettings: settingsPanelDisabled,
128
+ settings: /*#__PURE__*/_react["default"].createElement(Panel, {
129
+ model: model,
130
+ onChangeModel: onModelChanged,
131
+ configuration: configuration,
132
+ onChangeConfiguration: onConfigurationChanged,
133
+ pluginOpts: getPluginProps(rubriclessInstruction === null || rubriclessInstruction === void 0 ? void 0 : rubriclessInstruction.inputConfiguration),
134
+ groups: {
135
+ Properties: panelProperties
136
+ },
137
+ imageSupport: imageSupport
138
+ })
139
+ }, /*#__PURE__*/_react["default"].createElement("div", {
140
+ style: {
141
+ maxWidth: width
142
+ }
143
+ }, /*#__PURE__*/_react["default"].createElement(_index.Authoring, {
144
+ value: value,
145
+ config: configuration,
146
+ onChange: onModelChanged,
147
+ mathMlOptions: mathMlOptions,
148
+ rubricless: rubricless,
149
+ pluginOpts: baseInputConfiguration,
150
+ imageSupport: imageSupport
151
+ })));
152
+ }
153
+ }]);
154
+ return Main;
155
+ }(_react["default"].Component);
156
+
157
+ var _default = (0, _styles.withStyles)(styles)(Main);
158
+
159
+ exports["default"] = _default;
160
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","styles","theme","design","fontFamily","fontSize","typography","Main","m","config","rubricless","points","sampleAnswers","rest","props","model","configuration","onConfigurationChanged","onModelChanged","imageSupport","baseInputConfiguration","contentDimensions","settingsPanelDisabled","showExcludeZero","showMaxPoint","mathMlOptions","rubriclessInstruction","width","value","verifyRubriclessModel","panelProperties","excludeZeroEnabled","label","maxPointsEnabled","rubriclessInstructionEnabled","getPluginProps","Object","assign","inputConfiguration","Properties","maxWidth","React","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAQA,KAAR,GAA0BC,kBAA1B,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA0BD,kBAA1B,CAAeC,MAAf;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAE,cADN;AAENC,MAAAA,QAAQ,EAAEH,KAAK,CAACI,UAAN,CAAiBD;AAFrB;AADiB,GAAZ;AAAA,CAAf;;IAOME,I;;;;;;;;;;;;;;;8GACoB,UAACC,CAAD,EAAIC,MAAJ,EAAe;AACrC,iBAA+BA,MAAM,IAAI,EAAzC;AAAA,iCAAQC,UAAR;AAAA,UAAQA,UAAR,gCAAqB,KAArB;;AACA,aAAOA,UAAU,GAAI;AAAA,YAAGC,MAAH,SAAGA,MAAH;AAAA,YAAWC,aAAX,SAAWA,aAAX;AAAA,YAA6BC,IAA7B;AAAA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A,cAAiB,CAACrB,KAAD,EAAW;AAChC,eAAOsB,MAAM,CAACC,MAAP,mBAEAjB,sBAFA,GAILN,KAAK,IAAI,EAJJ,CAAP;AAMD,OAPD;;AASA,0BACE,gCAAC,gBAAD,CAAQ,YAAR;AACE,QAAA,UAAU,EAAEO,iBADd;AAEE,QAAA,YAAY,EAAEC,qBAFhB;AAGE,QAAA,QAAQ,eACN,gCAAC,KAAD;AACE,UAAA,KAAK,EAAEP,KADT;AAEE,UAAA,aAAa,EAAEG,cAFjB;AAGE,UAAA,aAAa,EAAEF,aAHjB;AAIE,UAAA,qBAAqB,EAAEC,sBAJzB;AAKE,UAAA,UAAU,EAAEkB,cAAc,CAACT,qBAAD,aAACA,qBAAD,uBAACA,qBAAqB,CAAEY,kBAAxB,CAL5B;AAME,UAAA,MAAM,EAAE;AACNC,YAAAA,UAAU,EAAET;AADN,WANV;AASE,UAAA,YAAY,EAAEX;AAThB;AAJJ,sBAiBE;AAAK,QAAA,KAAK,EAAE;AAAEqB,UAAAA,QAAQ,EAAEb;AAAZ;AAAZ,sBACE,gCAAC,gBAAD;AACE,QAAA,KAAK,EAAEC,KADT;AAEE,QAAA,MAAM,EAAEZ,aAFV;AAGE,QAAA,QAAQ,EAAEE,cAHZ;AAIE,QAAA,aAAa,EAAEO,aAJjB;AAKE,QAAA,UAAU,EAAEf,UALd;AAME,QAAA,UAAU,EAAEU,sBANd;AAOE,QAAA,YAAY,EAAED;AAPhB,QADF,CAjBF,CADF;AA+BD;;;EArEgBsB,kBAAMC,S;;eAwEV,wBAAWzC,MAAX,EAAmBM,IAAnB,C","sourcesContent":["import React from 'react';\nimport { Authoring } from './pie-toolbox-rubric/index';\nimport { withStyles } from '@material-ui/core/styles';\nimport { layout, settings } from '@pie-lib/pie-toolbox/config-ui';\n\nconst { Panel, toggle } = settings;\n\nconst styles = (theme) => ({\n design: {\n fontFamily: 'Cerebri Sans',\n fontSize: theme.typography.fontSize,\n },\n});\n\nclass Main extends React.Component {\n verifyRubriclessModel = (m, config) => {\n const { rubricless = false } = config || {};\n return rubricless ? (({ points, sampleAnswers, ...rest }) => rest)(m) : m;\n };\n\n render() {\n const { model, configuration, onConfigurationChanged, onModelChanged, imageSupport } = this.props || {};\n const {\n baseInputConfiguration = {},\n contentDimensions = {},\n settingsPanelDisabled,\n showExcludeZero = {},\n showMaxPoint = {},\n mathMlOptions = {},\n rubricless = false,\n rubriclessInstruction,\n width,\n } = configuration || {};\n\n // ensure to eliminate points and sampleAnswers in case of rubricless\n const value = this.verifyRubriclessModel(model, configuration);\n\n const panelProperties = {\n excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),\n maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),\n rubriclessInstructionEnabled: rubricless && rubriclessInstruction.settings && toggle(rubriclessInstruction.label),\n };\n\n const getPluginProps = (props) => {\n return Object.assign(\n {\n ...baseInputConfiguration,\n },\n props || {},\n );\n };\n\n return (\n <layout.ConfigLayout\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n pluginOpts={getPluginProps(rubriclessInstruction?.inputConfiguration)}\n groups={{\n Properties: panelProperties,\n }}\n imageSupport={imageSupport}\n />\n }\n >\n <div style={{ maxWidth: width }}>\n <Authoring\n value={value}\n config={configuration}\n onChange={onModelChanged}\n mathMlOptions={mathMlOptions}\n rubricless={rubricless}\n pluginOpts={baseInputConfiguration}\n imageSupport={imageSupport}\n />\n </div>\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}