@pie-element/rubric 3.8.2-next.7 → 3.8.3-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.8.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric@3.8.1...@pie-element/rubric@3.8.2) (2024-04-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **complex-rubric:** added imageSupport to fix missing image setting from editable-html ([4a40858](https://github.com/pie-framework/pie-elements/commit/4a408580d012d27bf333f117308483b4854e2b20))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.8.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric@3.8.0...@pie-element/rubric@3.8.1) (2024-04-01)
7
18
 
8
19
  **Note:** Version bump only for package @pie-element/rubric
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.7.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-configure@3.7.1...@pie-element/rubric-configure@3.7.2) (2024-04-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **complex-rubric:** added imageSupport to fix missing image setting from editable-html ([4a40858](https://github.com/pie-framework/pie-elements/commit/4a408580d012d27bf333f117308483b4854e2b20))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.7.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-configure@3.7.0...@pie-element/rubric-configure@3.7.1) (2024-04-01)
7
18
 
8
19
  **Note:** Version bump only for package @pie-element/rubric-configure
@@ -63,14 +63,21 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
63
63
 
64
64
  (0, _classCallCheck2["default"])(this, RubricElement);
65
65
  _this = _super.call(this);
66
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "validateModel", function (nextModel) {
66
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateModelAccordingToReceivedProps", function (nextModel) {
67
67
  var currentModel = _objectSpread({}, _this._model);
68
68
 
69
+ if (!nextModel) {
70
+ return currentModel;
71
+ }
72
+
69
73
  var validatedModel = nextModel;
70
- var maxPoints = validatedModel.maxPoints,
71
- excludeZero = validatedModel.excludeZero;
72
- validatedModel.points = (0, _toConsumableArray2["default"])(validatedModel.points);
73
- validatedModel.sampleAnswers = (0, _toConsumableArray2["default"])(validatedModel.sampleAnswers);
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) : [];
74
81
  var howManyPointsShouldHave = excludeZero ? maxPoints : maxPoints + 1;
75
82
  var howManyPointsDoesItHave = validatedModel.points.length;
76
83
  var excludeZeroChanged = (currentModel === null || currentModel === void 0 ? void 0 : currentModel.excludeZero) !== (nextModel === null || nextModel === void 0 ? void 0 : nextModel.excludeZero);
@@ -88,11 +95,7 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
88
95
  validatedModel.sampleAnswers.push(null);
89
96
  }
90
97
  }
91
-
92
- return validatedModel;
93
- }
94
-
95
- if (howManyPointsDoesItHave > howManyPointsShouldHave) {
98
+ } else if (howManyPointsDoesItHave > howManyPointsShouldHave) {
96
99
  if (excludeZeroChanged && excludeZero) {
97
100
  validatedModel.points = validatedModel.points.slice(1);
98
101
  validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(1);
@@ -128,7 +131,7 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
128
131
  (0, _createClass2["default"])(RubricElement, [{
129
132
  key: "model",
130
133
  set: function set(m) {
131
- this._model = this.validateModel(modelWithDefaults(m));
134
+ this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
132
135
 
133
136
  this._render();
134
137
  }
@@ -142,12 +145,22 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
142
145
  }, {
143
146
  key: "onModelChanged",
144
147
  value: function onModelChanged(m) {
145
- this._model = this.validateModel(m);
148
+ this._model = this.updateModelAccordingToReceivedProps(m);
146
149
 
147
150
  this._render();
148
151
 
149
152
  this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model, false));
150
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
+ }
151
164
  }, {
152
165
  key: "connectedCallback",
153
166
  value: function connectedCallback() {
@@ -163,7 +176,11 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
163
176
  model: this._model,
164
177
  configuration: this._configuration,
165
178
  onModelChanged: this.onModelChanged,
166
- onConfigurationChanged: this.onConfigurationChanged
179
+ onConfigurationChanged: this.onConfigurationChanged,
180
+ imageSupport: {
181
+ add: this.insertImage.bind(this),
182
+ "delete": this.onDeleteImage.bind(this)
183
+ }
167
184
  });
168
185
 
169
186
  _reactDom["default"].render(element, this);
@@ -1 +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","validateModel","dispatchEvent","ModelUpdatedEvent","console","element","React","createElement","Main","ReactDOM","render","HTM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GsCM,W","sourcesContent":["import {ModelUpdatedEvent} 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 validateModel = (nextModel) => {\n const currentModel = {...this._model};\n const validatedModel = nextModel;\n const {maxPoints, excludeZero} = validatedModel;\n\n validatedModel.points = [...validatedModel.points];\n 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 return validatedModel;\n }\n\n 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.validateModel(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.validateModel(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 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 });\n\n ReactDOM.render(element, this);\n }\n }\n}\n"],"file":"index.js"}
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;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,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"}
@@ -90,7 +90,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
90
90
  model = _ref3.model,
91
91
  configuration = _ref3.configuration,
92
92
  onConfigurationChanged = _ref3.onConfigurationChanged,
93
- onModelChanged = _ref3.onModelChanged;
93
+ onModelChanged = _ref3.onModelChanged,
94
+ imageSupport = _ref3.imageSupport;
94
95
 
95
96
  var _ref4 = configuration || {},
96
97
  _ref4$baseInputConfig = _ref4.baseInputConfiguration,
@@ -132,7 +133,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
132
133
  pluginOpts: getPluginProps(rubriclessInstruction === null || rubriclessInstruction === void 0 ? void 0 : rubriclessInstruction.inputConfiguration),
133
134
  groups: {
134
135
  Properties: panelProperties
135
- }
136
+ },
137
+ imageSupport: imageSupport
136
138
  })
137
139
  }, /*#__PURE__*/_react["default"].createElement("div", {
138
140
  style: {
@@ -144,7 +146,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
144
146
  onChange: onModelChanged,
145
147
  mathMlOptions: mathMlOptions,
146
148
  rubricless: rubricless,
147
- pluginOpts: baseInputConfiguration
149
+ pluginOpts: baseInputConfiguration,
150
+ imageSupport: imageSupport
148
151
  })));
149
152
  }
150
153
  }]);
@@ -1 +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","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,CAA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ACuB,YAAY,CAACQ,KAAd,CAF3B;AAGtBE,QAAAA,4BAA4B,EAAEvB,UAAU,IAAIe,qBAAqB,CAAC1B,QAApC,IAAgDC,MAAM,CAACyB,qBAAqB,CAACM,KAAvB;AAH9D,OAAxB;;AAMA,UAAMG,cAAc,GAAG,SAAjBA,cAAiB,CAACpB,KAAD,EAAW;AAChC,eAAOqB,MAAM,CAACC,MAAP,mBAEAjB,sBAFA,GAILL,KAAK,IAAI,EAJJ,CAAP;AAMD,OAPD;;AASA,0BACE,gCAAC,gBAAD,CAAQ,YAAR;AACE,QAAA,UAAU,EAAEM,iBADd;AAEE,QAAA,YAAY,EAAEC,qBAFhB;AAGE,QAAA,QAAQ,eACN,gCAAC,KAAD;AACE,UAAA,KAAK,EAAEN,KADT;AAEE,UAAA,aAAa,EAAEG,cAFjB;AAGE,UAAA,aAAa,EAAEF,aAHjB;AAIE,UAAA,qBAAqB,EAAEC,sBAJzB;AAKE,UAAA,UAAU,EAAEiB,cAAc,CAACT,qBAAD,aAACA,qBAAD,uBAACA,qBAAqB,CAAEY,kBAAxB,CAL5B;AAME,UAAA,MAAM,EAAE;AACNC,YAAAA,UAAU,EAAET;AADN;AANV;AAJJ,sBAgBE;AAAK,QAAA,KAAK,EAAE;AAAEU,UAAAA,QAAQ,EAAEb;AAAZ;AAAZ,sBACE,gCAAC,gBAAD;AACE,QAAA,KAAK,EAAEC,KADT;AAEE,QAAA,MAAM,EAAEX,aAFV;AAGE,QAAA,QAAQ,EAAEE,cAHZ;AAIE,QAAA,aAAa,EAAEM,aAJjB;AAKE,QAAA,UAAU,EAAEd,UALd;AAME,QAAA,UAAU,EAAES;AANd,QADF,CAhBF,CADF;AA6BD;;;EAnEgBqB,kBAAMC,S;;eAsEV,wBAAWxC,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 } = 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 />\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 />\n </div>\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
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,eAAwCA,IAAxC;AAAA,OAAD,CAA+CL,CAA/C,CAAH,GAAuDA,CAAxE;AACD,K;;;;;;WAED,kBAAS;AACP,kBAAuF,KAAKM,KAAL,IAAc,EAArG;AAAA,UAAQC,KAAR,SAAQA,KAAR;AAAA,UAAeC,aAAf,SAAeA,aAAf;AAAA,UAA8BC,sBAA9B,SAA8BA,sBAA9B;AAAA,UAAsDC,cAAtD,SAAsDA,cAAtD;AAAA,UAAsEC,YAAtE,SAAsEA,YAAtE;;AACA,kBAUIH,aAAa,IAAI,EAVrB;AAAA,wCACEI,sBADF;AAA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A,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"}
@@ -185,7 +185,9 @@ var PointConfig = (0, _styles.withStyles)(function (theme) {
185
185
  error = props.error,
186
186
  _props$pluginOpts = props.pluginOpts,
187
187
  pluginOpts = _props$pluginOpts === void 0 ? {} : _props$pluginOpts,
188
- excludeZero = props.excludeZero;
188
+ excludeZero = props.excludeZero,
189
+ _props$imageSupport = props.imageSupport,
190
+ imageSupport = _props$imageSupport === void 0 ? {} : _props$imageSupport;
189
191
  var pointsCount = excludeZero ? points + 1 : points;
190
192
  var pointsLabel = "".concat(pointsCount, " ").concat(pointsCount <= 1 ? 'pt' : 'pts');
191
193
  var showSampleAnswer = checkSampleAnswer(sampleAnswer);
@@ -204,7 +206,8 @@ var PointConfig = (0, _styles.withStyles)(function (theme) {
204
206
  pluginProps: pluginOpts,
205
207
  markup: content,
206
208
  onChange: props.onChange,
207
- mathMlOptions: mathMlOptions
209
+ mathMlOptions: mathMlOptions,
210
+ imageSupport: imageSupport
208
211
  }), /*#__PURE__*/_react["default"].createElement(_pointMenu["default"], {
209
212
  classes: {
210
213
  icon: classes.pointMenu
@@ -223,7 +226,8 @@ var PointConfig = (0, _styles.withStyles)(function (theme) {
223
226
  markup: sampleAnswer,
224
227
  pluginProps: pluginOpts,
225
228
  onChange: props.onSampleChange,
226
- mathMlOptions: mathMlOptions
229
+ mathMlOptions: mathMlOptions,
230
+ imageSupport: imageSupport
227
231
  })));
228
232
  });
229
233
  exports.PointConfig = PointConfig;
@@ -331,7 +335,9 @@ var RawAuthoring = /*#__PURE__*/function (_React$Component) {
331
335
  _this$props6$rubricle = _this$props6.rubricless,
332
336
  rubricless = _this$props6$rubricle === void 0 ? false : _this$props6$rubricle,
333
337
  _this$props6$pluginOp = _this$props6.pluginOpts,
334
- pluginOpts = _this$props6$pluginOp === void 0 ? {} : _this$props6$pluginOp;
338
+ pluginOpts = _this$props6$pluginOp === void 0 ? {} : _this$props6$pluginOp,
339
+ _this$props6$imageSup = _this$props6.imageSupport,
340
+ imageSupport = _this$props6$imageSup === void 0 ? {} : _this$props6$imageSup;
335
341
 
336
342
  var _ref = value || {},
337
343
  _ref$excludeZeroEnabl = _ref.excludeZeroEnabled,
@@ -373,7 +379,8 @@ var RawAuthoring = /*#__PURE__*/function (_React$Component) {
373
379
  max: maxMaxPoints < 100 ? maxMaxPoints : 100,
374
380
  value: maxPointsValue,
375
381
  onChange: this.changeMaxPoints,
376
- pluginOpts: pluginOpts
382
+ pluginOpts: pluginOpts,
383
+ imageSupport: imageSupport
377
384
  }), excludeZeroEnabled && /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
378
385
  label: "Exclude zeros",
379
386
  control: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
@@ -395,7 +402,8 @@ var RawAuthoring = /*#__PURE__*/function (_React$Component) {
395
402
  }, {
396
403
  language: 'special'
397
404
  }],
398
- mathMlOptions: mathMlOptions
405
+ mathMlOptions: mathMlOptions,
406
+ imageSupport: imageSupport
399
407
  })), /*#__PURE__*/_react["default"].createElement("div", {
400
408
  className: rubricless ? classes.rubricless : classes.container
401
409
  }, /*#__PURE__*/_react["default"].createElement(_reactBeautifulDnd.DragDropContext, {
@@ -430,6 +438,7 @@ var RawAuthoring = /*#__PURE__*/function (_React$Component) {
430
438
  },
431
439
  mathMlOptions: mathMlOptions,
432
440
  pluginOpts: pluginOpts,
441
+ imageSupport: imageSupport,
433
442
  excludeZero: value.excludeZero
434
443
  }));
435
444
  });
@@ -448,7 +457,11 @@ exports.RawAuthoring = RawAuthoring;
448
457
  config: _propTypes["default"].object,
449
458
  pluginOpts: _propTypes["default"].object,
450
459
  rubricless: _propTypes["default"].bool,
451
- onChange: _propTypes["default"].func
460
+ onChange: _propTypes["default"].func,
461
+ imageSupport: _propTypes["default"].shape({
462
+ add: _propTypes["default"].func.isRequired,
463
+ "delete": _propTypes["default"].func.isRequired
464
+ })
452
465
  });
453
466
  (0, _defineProperty2["default"])(RawAuthoring, "defaultProps", {});
454
467
 
@@ -490,7 +503,9 @@ var Reverse = function Reverse(props) {
490
503
  _ref4$config = _ref4.config,
491
504
  config = _ref4$config === void 0 ? {} : _ref4$config,
492
505
  _ref4$pluginOpts = _ref4.pluginOpts,
493
- pluginOpts = _ref4$pluginOpts === void 0 ? {} : _ref4$pluginOpts;
506
+ pluginOpts = _ref4$pluginOpts === void 0 ? {} : _ref4$pluginOpts,
507
+ _ref4$imageSupport = _ref4.imageSupport,
508
+ imageSupport = _ref4$imageSupport === void 0 ? {} : _ref4$imageSupport;
494
509
 
495
510
  var points = Array.from(props.value.points || []).reverse();
496
511
  var sampleAnswers = Array.from(props.value.sampleAnswers || []).reverse();
@@ -518,7 +533,8 @@ var Reverse = function Reverse(props) {
518
533
  config: config,
519
534
  onChange: onChange,
520
535
  rubricless: rubricless,
521
- pluginOpts: pluginOpts
536
+ pluginOpts: pluginOpts,
537
+ imageSupport: imageSupport
522
538
  });
523
539
  };
524
540
 
@@ -528,7 +544,11 @@ Reverse.propTypes = {
528
544
  pluginOpts: _propTypes["default"].object,
529
545
  rubricless: _propTypes["default"].bool,
530
546
  getIndex: _propTypes["default"].func,
531
- onChange: _propTypes["default"].func
547
+ onChange: _propTypes["default"].func,
548
+ imageSupport: _propTypes["default"].shape({
549
+ add: _propTypes["default"].func.isRequired,
550
+ "delete": _propTypes["default"].func.isRequired
551
+ })
532
552
  };
533
553
  var _default = Reverse;
534
554
  exports["default"] = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pie-toolbox-rubric/authoring.jsx"],"names":["log","reorder","list","startIndex","endIndex","result","Array","from","splice","removed","RubricType","PropTypes","shape","excludeZero","bool","points","arrayOf","string","sampleAnswers","maxPoints","number","rubriclessInstruction","MaxPoints","theme","formControl","minWidth","margin","spacing","unit","props","value","onChange","max","classes","e","target","map","v","checkSampleAnswer","sampleAnswer","PointConfig","pointConfig","row","display","width","position","editor","backgroundColor","palette","common","white","dragIndicator","paddingTop","color","grey","pointsLabel","paddingBottom","textTransform","sampleAnswersEditor","paddingLeft","pointMenu","right","errorText","fontSize","typography","error","main","content","mathMlOptions","pluginOpts","pointsCount","showSampleAnswer","icon","onMenuChange","onSampleChange","RawAuthoring","destination","source","index","input","type","items","clickedItem","changeContent","className","config","rubricless","excludeZeroEnabled","maxPointsEnabled","errors","rubriclessInstructionEnabled","maxMaxPoints","pointsDescriptorsErrors","Number","isFinite","console","warn","maxPointsValue","rubricTitle","changeMaxPoints","excludeZeros","label","inputContainer","changeRubriclessInstruction","language","container","dragEnd","provided","droppableProps","innerRef","p","toString","configHolder","draggableProps","dragHandleProps","length","onPointMenuChange","placeholder","React","Component","object","isRequired","func","styles","borderWidth","borderStyle","borderColor","padding","marginBottom","StyledRawAuthoring","Reverse","reverse","concat","propTypes","getIndex"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;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A,UAAU,EAAE1D,sBAAU6G,MAHJ;AAIlBlC,EAAAA,UAAU,EAAE3E,sBAAUG,IAJJ;AAKlBwH,EAAAA,QAAQ,EAAE3H,sBAAU+G,IALF;AAMlB3F,EAAAA,QAAQ,EAAEpB,sBAAU+G;AANF,CAApB;eASeQ,O","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport OutlinedInput from '@material-ui/core/OutlinedInput';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Select from '@material-ui/core/Select';\nimport FormControl from '@material-ui/core/FormControl';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport times from 'lodash/times';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport grey from '@material-ui/core/colors/grey';\nimport Typography from '@material-ui/core/Typography';\nimport DragIndicator from '@material-ui/icons/DragIndicator';\nimport EditableHtml from '@pie-lib/pie-toolbox/editable-html';\nimport { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';\nimport debug from 'debug';\nimport takeRight from 'lodash/takeRight';\nimport PointMenu from './point-menu';\n\nimport range from 'lodash/range';\nimport { InputContainer } from '@pie-lib/pie-toolbox/config-ui';\n\nconst log = debug('pie-lib:rubric:authoring');\n\nconst reorder = (list, startIndex, endIndex) => {\n const result = Array.from(list);\n const [removed] = result.splice(startIndex, 1);\n\n result.splice(endIndex, 0, removed);\n\n return result;\n};\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string),\n maxPoints: PropTypes.number,\n rubriclessInstruction: PropTypes.string,\n});\n\nconst MaxPoints = withStyles((theme) => ({\n formControl: {\n minWidth: '120px',\n margin: theme.spacing.unit,\n },\n}))((props) => {\n const { value, onChange, max, classes } = props;\n\n return (\n <FormControl className={classes.formControl} variant=\"outlined\">\n <InputLabel width={100} htmlFor=\"...\">\n Max Points\n </InputLabel>\n <Select value={value} onChange={(e) => onChange(e.target.value)} input={<OutlinedInput labelWidth={80} />}>\n {range(1, max + 1).map((v) => (\n <MenuItem key={`${v}`} value={v}>\n {v}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n});\n\n// if the value is null or 'null', the Sample Answer input field for that point will not be dispalyed\n// if the value is '', the Sample Answer input field will be empty\nconst checkSampleAnswer = (sampleAnswer) => sampleAnswer === null || sampleAnswer === 'null';\n\nexport const PointConfig = withStyles((theme) => ({\n pointConfig: {},\n row: {\n display: 'flex',\n width: '100%',\n position: 'relative',\n },\n editor: {\n width: '100%',\n backgroundColor: `${theme.palette.common.white} !important`,\n },\n dragIndicator: {\n paddingTop: theme.spacing.unit,\n color: grey[500],\n },\n pointsLabel: {\n color: grey[500],\n paddingBottom: theme.spacing.unit,\n textTransform: 'uppercase',\n },\n sampleAnswersEditor: {\n paddingLeft: theme.spacing.unit * 3,\n },\n pointMenu: {\n position: 'absolute',\n right: 0,\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingLeft: theme.spacing.unit * 3,\n paddingTop: theme.spacing.unit,\n },\n}))((props) => {\n const { points, content, classes, sampleAnswer, mathMlOptions = {}, error, pluginOpts = {}, excludeZero } = props;\n const pointsCount = excludeZero ? points + 1 : points;\n const pointsLabel = `${pointsCount} ${pointsCount <= 1 ? 'pt' : 'pts'}`;\n const showSampleAnswer = checkSampleAnswer(sampleAnswer);\n\n return (\n <div className={classes.pointConfig}>\n <Typography variant=\"overline\" className={classes.pointsLabel}>\n {pointsLabel}\n </Typography>\n\n <div className={classes.row}>\n <DragIndicator className={classes.dragIndicator} />\n <EditableHtml\n className={classes.editor}\n error={error}\n pluginProps={pluginOpts}\n markup={content}\n onChange={props.onChange}\n mathMlOptions={mathMlOptions}\n />\n <PointMenu\n classes={{\n icon: classes.pointMenu,\n }}\n showSampleAnswer={showSampleAnswer}\n onChange={props.onMenuChange}\n />\n </div>\n {error && <div className={classes.errorText}>{error}</div>}\n {!showSampleAnswer && (\n <div className={classes.sampleAnswersEditor}>\n <Typography variant=\"overline\" className={classes.dragIndicator}>\n Sample Response\n </Typography>\n <EditableHtml\n className={classes.editor}\n markup={sampleAnswer}\n pluginProps={pluginOpts}\n onChange={props.onSampleChange}\n mathMlOptions={mathMlOptions}\n />\n </div>\n )}\n </div>\n );\n});\n\nexport class RawAuthoring extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n value: RubricType,\n config: PropTypes.object,\n pluginOpts: PropTypes.object,\n rubricless: PropTypes.bool,\n onChange: PropTypes.func,\n };\n\n static defaultProps = {};\n\n dragEnd = (result) => {\n if (!result.destination) {\n return;\n }\n\n const { value, onChange } = this.props;\n\n const points = reorder(value.points, result.source.index, result.destination.index);\n const sampleAnswers = reorder(value.sampleAnswers, result.source.index, result.destination.index);\n\n onChange({ ...value, points, sampleAnswers });\n };\n\n changeRubriclessInstruction = (input) => {\n const { value, onChange } = this.props;\n onChange({ ...value, rubriclessInstruction: input });\n };\n\n changeMaxPoints = (maxPoints) => {\n const { value, onChange } = this.props;\n\n onChange({ ...value, maxPoints });\n };\n\n changeContent = (index, content, type) => {\n // type could be 'points' or 'sampleAnswers'\n log(`changeModel[${type}]:`, index, content);\n\n if (type !== 'points' && type !== 'sampleAnswers') {\n return;\n }\n\n const { value, onChange } = this.props;\n const items = value[type] && Array.from(value[type]);\n\n items.splice(index, 1, content);\n log(`changeModel[${type}]:`, items);\n\n onChange({ ...value, [type]: items });\n };\n\n excludeZeros = () => {\n const { value, onChange } = this.props;\n\n onChange({ ...value, excludeZero: !value.excludeZero });\n };\n\n onPointMenuChange = (index, clickedItem) => {\n if (clickedItem === 'sample') {\n const { value } = this.props;\n const sampleAnswers = Array.from(value.sampleAnswers || []);\n\n if (checkSampleAnswer(sampleAnswers[index])) {\n // an empty string will display an empty Sample Answer input field\n this.changeContent(index, '', 'sampleAnswers');\n } else {\n // when the content is null or 'null', the Sample Answer input field will not be displayed\n this.changeContent(index, null, 'sampleAnswers');\n }\n }\n };\n\n render() {\n const {\n classes,\n className,\n value,\n mathMlOptions = {},\n config = {},\n rubricless = false,\n pluginOpts = {},\n } = this.props;\n let {\n excludeZeroEnabled = true,\n maxPointsEnabled = true,\n errors = {},\n rubriclessInstructionEnabled = false,\n maxPoints = 10,\n } = value || {};\n // rubric will contain a max value for maxPoints\n const { rubriclessInstruction = {}, maxMaxPoints = 10 } = config || {};\n const { pointsDescriptorsErrors } = errors || {};\n if (value && Number.isFinite(value.maxPoints)) {\n // eslint-disable-next-line no-console\n console.warn('maxPoints is deprecated - remove from model');\n }\n\n // for rubric value is computed based on points\n const maxPointsValue = maxPoints;\n\n return (\n <div className={classNames(classes.class, className)}>\n <Typography variant=\"h5\" className={classes.rubricTitle}>\n Rubric\n </Typography>\n <FormGroup row>\n {maxPointsEnabled && (\n <MaxPoints\n max={maxMaxPoints < 100 ? maxMaxPoints : 100}\n value={maxPointsValue}\n onChange={this.changeMaxPoints}\n pluginOpts={pluginOpts}\n />\n )}\n {excludeZeroEnabled && (\n <FormControlLabel\n label=\"Exclude zeros\"\n control={<Checkbox checked={value.excludeZero} onChange={this.excludeZeros} />}\n />\n )}\n </FormGroup>\n\n {rubriclessInstructionEnabled && rubricless && (\n <InputContainer label={rubriclessInstruction.label} className={classes.inputContainer}>\n <EditableHtml\n className={classes.input}\n markup={value.rubriclessInstruction || ''}\n onChange={this.changeRubriclessInstruction}\n pluginProps={pluginOpts}\n nonEmpty={false}\n disableUnderline\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n </InputContainer>\n )}\n\n <div className={rubricless ? classes.rubricless : classes.container}>\n <DragDropContext onDragEnd={this.dragEnd}>\n <Droppable droppableId=\"droppable\">\n {(provided) => (\n <div {...provided.droppableProps} ref={provided.innerRef}>\n {value.points.map(\n (p, index) => {\n return (\n <Draggable key={`${p.points}-${index}`} index={index} draggableId={index.toString()}>\n {(provided) => (\n <div\n className={classes.configHolder}\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n >\n <PointConfig\n points={value.points.length - 1 - index}\n content={p}\n error={\n pointsDescriptorsErrors && pointsDescriptorsErrors[value.points.length - 1 - index]\n }\n sampleAnswer={value.sampleAnswers && value.sampleAnswers[index]}\n onChange={(content) => this.changeContent(index, content, 'points')}\n onSampleChange={(content) => this.changeContent(index, content, 'sampleAnswers')}\n onMenuChange={(clickedItem) => this.onPointMenuChange(index, clickedItem)}\n mathMlOptions={mathMlOptions}\n pluginOpts={pluginOpts}\n excludeZero={value.excludeZero}\n />\n </div>\n )}\n </Draggable>\n );\n },\n )}\n {provided.placeholder}\n </div>\n )}\n </Droppable>\n </DragDropContext>\n </div>\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n container: {\n backgroundColor: grey[200],\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: grey[300],\n padding: theme.spacing.unit * 2,\n margin: theme.spacing.unit,\n },\n inputContainer: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n rubricless: {\n display: 'none',\n },\n configHolder: {\n paddingTop: theme.spacing.unit,\n paddingBottom: theme.spacing.unit,\n },\n rubricTitle: {\n paddingLeft: theme.spacing.unit,\n margin: theme.spacing.unit,\n },\n});\n\nconst StyledRawAuthoring = withStyles(styles)(RawAuthoring);\n\nconst Reverse = (props) => {\n const { rubricless = false, config = {}, pluginOpts = {} } = props || {};\n const points = Array.from(props.value.points || []).reverse();\n let sampleAnswers = Array.from(props.value.sampleAnswers || []).reverse();\n\n if (points.length > sampleAnswers.length) {\n sampleAnswers = times(points.length - sampleAnswers.length)\n .map(() => null)\n .concat(sampleAnswers);\n }\n\n const value = { ...props.value, points, sampleAnswers };\n\n const onChange = (value) => {\n props.onChange({\n ...value,\n points: Array.from(value.points || []).reverse(),\n sampleAnswers: Array.from(value.sampleAnswers || []).reverse(),\n });\n };\n\n return (\n <StyledRawAuthoring\n value={value}\n config={config}\n onChange={onChange}\n rubricless={rubricless}\n pluginOpts={pluginOpts}\n />\n );\n};\n\nReverse.propTypes = {\n value: RubricType,\n config: PropTypes.object,\n pluginOpts: PropTypes.object,\n rubricless: PropTypes.bool,\n getIndex: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default Reverse;\n"],"file":"authoring.js"}
1
+ {"version":3,"sources":["../../src/pie-toolbox-rubric/authoring.jsx"],"names":["log","reorder","list","startIndex","endIndex","result","Array","from","splice","removed","RubricType","PropTypes","shape","excludeZero","bool","points","arrayOf","string","sampleAnswers","maxPoints","number","rubriclessInstruction","MaxPoints","theme","formControl","minWidth","margin","spacing","unit","props","value","onChange","max","classes","e","target","map","v","checkSampleAnswer","sampleAnswer","PointConfig","pointConfig","row","display","width","position","editor","backgroundColor","palette","common","white","dragIndicator","paddingTop","color","grey","pointsLabel","paddingBottom","textTransform","sampleAnswersEditor","paddingLeft","pointMenu","right","errorText","fontSize","typography","error","main","content","mathMlOptions","pluginOpts","imageSupport","pointsCount","showSampleAnswer","icon","onMenuChange","onSampleChange","RawAuthoring","destination","source","index","input","type","items","clickedItem","changeContent","className","config","rubricless","excludeZeroEnabled","maxPointsEnabled","errors","rubriclessInstructionEnabled","maxMaxPoints","pointsDescriptorsErrors","Number","isFinite","console","warn","maxPointsValue","rubricTitle","changeMaxPoints","excludeZeros","label","inputContainer","changeRubriclessInstruction","language","container","dragEnd","provided","droppableProps","innerRef","p","toString","configHolder","draggableProps","dragHandleProps","length","onPointMenuChange","placeholder","React","Component","object","isRequired","func","add","styles","borderWidth","borderStyle","borderColor","padding","marginBottom","StyledRawAuthoring","Reverse","reverse","concat","propTypes","getIndex"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;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AN,CAAWuB,KAAK,CAACf,MAAN,IAAgB,EAA3B,EAA+BsH,OAA/B,EAFV;AAGEnH,MAAAA,aAAa,EAAEZ,KAAK,CAACC,IAAN,CAAWuB,KAAK,CAACZ,aAAN,IAAuB,EAAlC,EAAsCmH,OAAtC;AAHjB;AAKD,GAND;;AAQA,sBACE,gCAAC,kBAAD;AACE,IAAA,KAAK,EAAEvG,KADT;AAEE,IAAA,MAAM,EAAEwD,MAFV;AAGE,IAAA,QAAQ,EAAEvD,QAHZ;AAIE,IAAA,UAAU,EAAEwD,UAJd;AAKE,IAAA,UAAU,EAAElB,UALd;AAME,IAAA,YAAY,EAAEC;AANhB,IADF;AAUD,CA/BD;;AAiCA8D,OAAO,CAACG,SAAR,GAAoB;AAClBzG,EAAAA,KAAK,EAAEpB,UADW;AAElB4E,EAAAA,MAAM,EAAE3E,sBAAU8G,MAFA;AAGlBpD,EAAAA,UAAU,EAAE1D,sBAAU8G,MAHJ;AAIlBlC,EAAAA,UAAU,EAAE5E,sBAAUG,IAJJ;AAKlB0H,EAAAA,QAAQ,EAAE7H,sBAAUgH,IALF;AAMlB5F,EAAAA,QAAQ,EAAEpB,sBAAUgH,IANF;AAOlBrD,EAAAA,YAAY,EAAE3D,sBAAUC,KAAV,CAAgB;AAC5BgH,IAAAA,GAAG,EAAEjH,sBAAUgH,IAAV,CAAeD,UADQ;AAE5B,cAAQ/G,sBAAUgH,IAAV,CAAeD;AAFK,GAAhB;AAPI,CAApB;eAaeU,O","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport OutlinedInput from '@material-ui/core/OutlinedInput';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Select from '@material-ui/core/Select';\nimport FormControl from '@material-ui/core/FormControl';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport times from 'lodash/times';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport grey from '@material-ui/core/colors/grey';\nimport Typography from '@material-ui/core/Typography';\nimport DragIndicator from '@material-ui/icons/DragIndicator';\nimport EditableHtml from '@pie-lib/pie-toolbox/editable-html';\nimport { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';\nimport debug from 'debug';\nimport takeRight from 'lodash/takeRight';\nimport PointMenu from './point-menu';\n\nimport range from 'lodash/range';\nimport { InputContainer } from '@pie-lib/pie-toolbox/config-ui';\n\nconst log = debug('pie-lib:rubric:authoring');\n\nconst reorder = (list, startIndex, endIndex) => {\n const result = Array.from(list);\n const [removed] = result.splice(startIndex, 1);\n\n result.splice(endIndex, 0, removed);\n\n return result;\n};\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string),\n maxPoints: PropTypes.number,\n rubriclessInstruction: PropTypes.string,\n});\n\nconst MaxPoints = withStyles((theme) => ({\n formControl: {\n minWidth: '120px',\n margin: theme.spacing.unit,\n },\n}))((props) => {\n const { value, onChange, max, classes } = props;\n\n return (\n <FormControl className={classes.formControl} variant=\"outlined\">\n <InputLabel width={100} htmlFor=\"...\">\n Max Points\n </InputLabel>\n <Select value={value} onChange={(e) => onChange(e.target.value)} input={<OutlinedInput labelWidth={80} />}>\n {range(1, max + 1).map((v) => (\n <MenuItem key={`${v}`} value={v}>\n {v}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n});\n\n// if the value is null or 'null', the Sample Answer input field for that point will not be dispalyed\n// if the value is '', the Sample Answer input field will be empty\nconst checkSampleAnswer = (sampleAnswer) => sampleAnswer === null || sampleAnswer === 'null';\n\nexport const PointConfig = withStyles((theme) => ({\n pointConfig: {},\n row: {\n display: 'flex',\n width: '100%',\n position: 'relative',\n },\n editor: {\n width: '100%',\n backgroundColor: `${theme.palette.common.white} !important`,\n },\n dragIndicator: {\n paddingTop: theme.spacing.unit,\n color: grey[500],\n },\n pointsLabel: {\n color: grey[500],\n paddingBottom: theme.spacing.unit,\n textTransform: 'uppercase',\n },\n sampleAnswersEditor: {\n paddingLeft: theme.spacing.unit * 3,\n },\n pointMenu: {\n position: 'absolute',\n right: 0,\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingLeft: theme.spacing.unit * 3,\n paddingTop: theme.spacing.unit,\n },\n}))((props) => {\n const { points, content, classes, sampleAnswer, mathMlOptions = {}, error, pluginOpts = {}, excludeZero, imageSupport = {}, } = props;\n const pointsCount = excludeZero ? points + 1 : points;\n const pointsLabel = `${pointsCount} ${pointsCount <= 1 ? 'pt' : 'pts'}`;\n const showSampleAnswer = checkSampleAnswer(sampleAnswer);\n\n return (\n <div className={classes.pointConfig}>\n <Typography variant=\"overline\" className={classes.pointsLabel}>\n {pointsLabel}\n </Typography>\n\n <div className={classes.row}>\n <DragIndicator className={classes.dragIndicator} />\n <EditableHtml\n className={classes.editor}\n error={error}\n pluginProps={pluginOpts}\n markup={content}\n onChange={props.onChange}\n mathMlOptions={mathMlOptions}\n imageSupport={imageSupport}\n />\n <PointMenu\n classes={{\n icon: classes.pointMenu,\n }}\n showSampleAnswer={showSampleAnswer}\n onChange={props.onMenuChange}\n />\n </div>\n {error && <div className={classes.errorText}>{error}</div>}\n {!showSampleAnswer && (\n <div className={classes.sampleAnswersEditor}>\n <Typography variant=\"overline\" className={classes.dragIndicator}>\n Sample Response\n </Typography>\n <EditableHtml\n className={classes.editor}\n markup={sampleAnswer}\n pluginProps={pluginOpts}\n onChange={props.onSampleChange}\n mathMlOptions={mathMlOptions}\n imageSupport={imageSupport}\n />\n </div>\n )}\n </div>\n );\n});\n\nexport class RawAuthoring extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n value: RubricType,\n config: PropTypes.object,\n pluginOpts: PropTypes.object,\n rubricless: PropTypes.bool,\n onChange: PropTypes.func,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n static defaultProps = {};\n\n dragEnd = (result) => {\n if (!result.destination) {\n return;\n }\n\n const { value, onChange } = this.props;\n\n const points = reorder(value.points, result.source.index, result.destination.index);\n const sampleAnswers = reorder(value.sampleAnswers, result.source.index, result.destination.index);\n\n onChange({ ...value, points, sampleAnswers });\n };\n\n changeRubriclessInstruction = (input) => {\n const { value, onChange } = this.props;\n onChange({ ...value, rubriclessInstruction: input });\n };\n\n changeMaxPoints = (maxPoints) => {\n const { value, onChange } = this.props;\n\n onChange({ ...value, maxPoints });\n };\n\n changeContent = (index, content, type) => {\n // type could be 'points' or 'sampleAnswers'\n log(`changeModel[${type}]:`, index, content);\n\n if (type !== 'points' && type !== 'sampleAnswers') {\n return;\n }\n\n const { value, onChange } = this.props;\n const items = value[type] && Array.from(value[type]);\n\n items.splice(index, 1, content);\n log(`changeModel[${type}]:`, items);\n\n onChange({ ...value, [type]: items });\n };\n\n excludeZeros = () => {\n const { value, onChange } = this.props;\n\n onChange({ ...value, excludeZero: !value.excludeZero });\n };\n\n onPointMenuChange = (index, clickedItem) => {\n if (clickedItem === 'sample') {\n const { value } = this.props;\n const sampleAnswers = Array.from(value.sampleAnswers || []);\n\n if (checkSampleAnswer(sampleAnswers[index])) {\n // an empty string will display an empty Sample Answer input field\n this.changeContent(index, '', 'sampleAnswers');\n } else {\n // when the content is null or 'null', the Sample Answer input field will not be displayed\n this.changeContent(index, null, 'sampleAnswers');\n }\n }\n };\n\n render() {\n const {\n classes,\n className,\n value,\n mathMlOptions = {},\n config = {},\n rubricless = false,\n pluginOpts = {},\n imageSupport = {},\n } = this.props;\n let {\n excludeZeroEnabled = true,\n maxPointsEnabled = true,\n errors = {},\n rubriclessInstructionEnabled = false,\n maxPoints = 10,\n } = value || {};\n // rubric will contain a max value for maxPoints\n const { rubriclessInstruction = {}, maxMaxPoints = 10 } = config || {};\n const { pointsDescriptorsErrors } = errors || {};\n if (value && Number.isFinite(value.maxPoints)) {\n // eslint-disable-next-line no-console\n console.warn('maxPoints is deprecated - remove from model');\n }\n\n // for rubric value is computed based on points\n const maxPointsValue = maxPoints;\n\n return (\n <div className={classNames(classes.class, className)}>\n <Typography variant=\"h5\" className={classes.rubricTitle}>\n Rubric\n </Typography>\n <FormGroup row>\n {maxPointsEnabled && (\n <MaxPoints\n max={maxMaxPoints < 100 ? maxMaxPoints : 100}\n value={maxPointsValue}\n onChange={this.changeMaxPoints}\n pluginOpts={pluginOpts}\n imageSupport={imageSupport}\n />\n )}\n {excludeZeroEnabled && (\n <FormControlLabel\n label=\"Exclude zeros\"\n control={<Checkbox checked={value.excludeZero} onChange={this.excludeZeros} />}\n />\n )}\n </FormGroup>\n\n {rubriclessInstructionEnabled && rubricless && (\n <InputContainer label={rubriclessInstruction.label} className={classes.inputContainer}>\n <EditableHtml\n className={classes.input}\n markup={value.rubriclessInstruction || ''}\n onChange={this.changeRubriclessInstruction}\n pluginProps={pluginOpts}\n nonEmpty={false}\n disableUnderline\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n imageSupport={imageSupport}\n />\n </InputContainer>\n )}\n\n <div className={rubricless ? classes.rubricless : classes.container}>\n <DragDropContext onDragEnd={this.dragEnd}>\n <Droppable droppableId=\"droppable\">\n {(provided) => (\n <div {...provided.droppableProps} ref={provided.innerRef}>\n {value.points.map(\n (p, index) => {\n return (\n <Draggable key={`${p.points}-${index}`} index={index} draggableId={index.toString()}>\n {(provided) => (\n <div\n className={classes.configHolder}\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n >\n <PointConfig\n points={value.points.length - 1 - index}\n content={p}\n error={\n pointsDescriptorsErrors && pointsDescriptorsErrors[value.points.length - 1 - index]\n }\n sampleAnswer={value.sampleAnswers && value.sampleAnswers[index]}\n onChange={(content) => this.changeContent(index, content, 'points')}\n onSampleChange={(content) => this.changeContent(index, content, 'sampleAnswers')}\n onMenuChange={(clickedItem) => this.onPointMenuChange(index, clickedItem)}\n mathMlOptions={mathMlOptions}\n pluginOpts={pluginOpts}\n imageSupport={imageSupport}\n excludeZero={value.excludeZero}\n />\n </div>\n )}\n </Draggable>\n );\n },\n )}\n {provided.placeholder}\n </div>\n )}\n </Droppable>\n </DragDropContext>\n </div>\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n container: {\n backgroundColor: grey[200],\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: grey[300],\n padding: theme.spacing.unit * 2,\n margin: theme.spacing.unit,\n },\n inputContainer: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n rubricless: {\n display: 'none',\n },\n configHolder: {\n paddingTop: theme.spacing.unit,\n paddingBottom: theme.spacing.unit,\n },\n rubricTitle: {\n paddingLeft: theme.spacing.unit,\n margin: theme.spacing.unit,\n },\n});\n\nconst StyledRawAuthoring = withStyles(styles)(RawAuthoring);\n\nconst Reverse = (props) => {\n const { rubricless = false, config = {}, pluginOpts = {}, imageSupport = {} } = props || {};\n const points = Array.from(props.value.points || []).reverse();\n let sampleAnswers = Array.from(props.value.sampleAnswers || []).reverse();\n\n if (points.length > sampleAnswers.length) {\n sampleAnswers = times(points.length - sampleAnswers.length)\n .map(() => null)\n .concat(sampleAnswers);\n }\n\n const value = { ...props.value, points, sampleAnswers };\n\n const onChange = (value) => {\n props.onChange({\n ...value,\n points: Array.from(value.points || []).reverse(),\n sampleAnswers: Array.from(value.sampleAnswers || []).reverse(),\n });\n };\n\n return (\n <StyledRawAuthoring\n value={value}\n config={config}\n onChange={onChange}\n rubricless={rubricless}\n pluginOpts={pluginOpts}\n imageSupport={imageSupport}\n />\n );\n};\n\nReverse.propTypes = {\n value: RubricType,\n config: PropTypes.object,\n pluginOpts: PropTypes.object,\n rubricless: PropTypes.bool,\n getIndex: PropTypes.func,\n onChange: PropTypes.func,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n};\n\nexport default Reverse;\n"],"file":"authoring.js"}
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@pie-element/rubric-configure",
3
3
  "private": true,
4
- "version": "3.7.1",
4
+ "version": "3.7.2",
5
5
  "description": "Rubric authoring view",
6
6
  "main": "lib/index.js",
7
7
  "author": "Pie Framework Authors",
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/pie-toolbox": "1.13.1",
11
+ "@pie-lib/pie-toolbox": "1.15.0",
12
12
  "debug": "^4.1.1",
13
13
  "react": "^16.8.6",
14
14
  "react-dom": "^16.8.6"
@@ -0,0 +1,154 @@
1
+ import RubricElement from '../index';
2
+ import defaults from '../defaults';
3
+ import { ModelUpdatedEvent, InsertSoundEvent, DeleteSoundEvent } from '@pie-framework/pie-configure-events';
4
+ import React from "react";
5
+
6
+ jest.mock('react-dom', () => ({
7
+ render: jest.fn(),
8
+ }));
9
+
10
+ const model = (extras) => ({
11
+ id: '1',
12
+ element: 'pie-rubric',
13
+ points: ['A', 'B', 'C', 'D'],
14
+ sampleAnswers: [true, true, false, false],
15
+ maxPoints: 3,
16
+ excludeZero: false,
17
+ excludeZeroEnabled: true,
18
+ maxPointsEnabled: true,
19
+ ...extras,
20
+ });
21
+ const configuration = (c) => ({...defaults.configuration, ...c});
22
+
23
+ describe('RubricElement', () => {
24
+ let element;
25
+
26
+ beforeEach(() => {
27
+ element = new RubricElement();
28
+ });
29
+
30
+ afterEach(() => {
31
+ jest.clearAllMocks();
32
+ });
33
+
34
+ describe('set model', () => {
35
+ it('should set the model correctly', () => {
36
+ const newModel = model();
37
+ element.model = newModel;
38
+ expect(element._model).toEqual(newModel);
39
+ });
40
+ });
41
+
42
+ describe('onModelChanged', () => {
43
+ it('should dispatch ModelUpdatedEvent on model change', () => {
44
+ const newModel = model();
45
+ const dispatchEventSpy = jest.spyOn(element, 'dispatchEvent');
46
+ element.onModelChanged(newModel);
47
+ expect(element._model).toEqual(newModel);
48
+ expect(dispatchEventSpy).toHaveBeenCalledWith(new ModelUpdatedEvent(newModel, false));
49
+ });
50
+ });
51
+
52
+ describe('set configuration', () => {
53
+ it('should set the configuration correctly', () => {
54
+ const newConfiguration = configuration();
55
+ element.configuration = newConfiguration;
56
+ expect(element._configuration).toEqual(newConfiguration);
57
+ });
58
+ });
59
+
60
+ describe('onConfigurationChanged', () => {
61
+ it('should call _render method on configuration change and overwrite the defaults with the new values', () => {
62
+ const newConfiguration = configuration({maxMaxPoints: 10});
63
+ const renderSpy = jest.spyOn(element, '_render');
64
+ element.onConfigurationChanged(newConfiguration);
65
+ expect(element._configuration.maxMaxPoints).toEqual(10);
66
+ expect(renderSpy).toHaveBeenCalled();
67
+ });
68
+ });
69
+
70
+ describe('updateModelAccordingToReceivedProps', () => {
71
+ it('should return the same model if it is already valid', () => {
72
+ const validModel = model();
73
+ const validatedModel = element.updateModelAccordingToReceivedProps(validModel);
74
+ expect(validatedModel).toEqual(validModel);
75
+ });
76
+
77
+ it('should return an empty model if the input model is undefined', () => {
78
+ const validatedModel = element.updateModelAccordingToReceivedProps(undefined);
79
+ expect(validatedModel).toEqual(defaults.model);
80
+ });
81
+
82
+ it('should return an empty model if the input model is null', () => {
83
+ const validatedModel = element.updateModelAccordingToReceivedProps(null);
84
+ expect(validatedModel).toEqual(defaults.model);
85
+ });
86
+
87
+ it('should handle undefined properties in the input model', () => {
88
+ const validatedModel = element.updateModelAccordingToReceivedProps({});
89
+ expect(validatedModel).toEqual({"points": [], "sampleAnswers": []});
90
+ });
91
+
92
+ it('should handle null properties in the input model', () => {
93
+ const validatedModel = element.updateModelAccordingToReceivedProps({ maxPoints: null, excludeZero: null });
94
+ expect(validatedModel).toEqual( {"excludeZero": null, "maxPoints": null, "points": ["", ""], "sampleAnswers": [null, null]});
95
+ });
96
+
97
+ it('should handle undefined points and sampleAnswers arrays', () => {
98
+ const validatedModel = element.updateModelAccordingToReceivedProps({ maxPoints: 5, excludeZero: false });
99
+ expect(validatedModel.points).toEqual(['', '', '', '', '', '']);
100
+ expect(validatedModel.sampleAnswers).toEqual([null, null, null, null, null, null]);
101
+ });
102
+
103
+ it('should handle case when howManyPointsDoesItHave is less than howManyPointsShouldHave with maxPoints & excludeZero changed', () => {
104
+ const nextModel = model({
105
+ maxPoints: 7,
106
+ excludeZero: true,
107
+ });
108
+ const result = element.updateModelAccordingToReceivedProps(nextModel);
109
+ expect(result.points).toEqual(['A', 'B', 'C', 'D', '', '', '']);
110
+ expect(result.sampleAnswers).toEqual([true, true, false, false, null, null, null]);
111
+ });
112
+
113
+ it('should handle case when howManyPointsDoesItHave is less than howManyPointsShouldHave and maxPointsChanged', () => {
114
+ const nextModel = model({
115
+ maxPoints: 4,
116
+ excludeZero: false
117
+ });
118
+ const result = element.updateModelAccordingToReceivedProps(nextModel);
119
+ expect(result.points).toEqual(['A', 'B', 'C', 'D', '']);
120
+ expect(result.sampleAnswers).toEqual([true, true, false, false, null]);
121
+ });
122
+
123
+ it('should handle case when howManyPointsDoesItHave is greater than howManyPointsShouldHave and excludeZeroChanged', () => {
124
+ const nextModel = model({
125
+ maxPoints: 3,
126
+ excludeZero: true,
127
+ });
128
+ const result = element.updateModelAccordingToReceivedProps(nextModel);
129
+ expect(result.points).toEqual(['B', 'C', 'D']);
130
+ expect(result.sampleAnswers).toEqual([true, false, false]);
131
+ });
132
+
133
+ it('should handle case when howManyPointsDoesItHave is greater than howManyPointsShouldHave and maxPointsChanged', () => {
134
+ const nextModel = model({
135
+ maxPoints: 1,
136
+ excludeZero: false,
137
+ });
138
+ const result = element.updateModelAccordingToReceivedProps(nextModel);
139
+ expect(result.points).toEqual(['A','B']);
140
+ expect(result.sampleAnswers).toEqual([true, true]);
141
+ });
142
+
143
+ it('should handle case when howManyPointsDoesItHave is greater than howManyPointsShouldHave, maxPointsChanged & excludeZeroChanged', () => {
144
+ const nextModel = model({
145
+ maxPoints: 1,
146
+ excludeZero: true,
147
+ });
148
+ const result = element.updateModelAccordingToReceivedProps(nextModel);
149
+ expect(result.points).toEqual(['B']);
150
+ expect(result.sampleAnswers).toEqual([true]);
151
+ });
152
+ });
153
+
154
+ });
@@ -1,4 +1,8 @@
1
- import {ModelUpdatedEvent} from '@pie-framework/pie-configure-events';
1
+ import {
2
+ ModelUpdatedEvent,
3
+ InsertImageEvent,
4
+ DeleteImageEvent
5
+ } from '@pie-framework/pie-configure-events';
2
6
  import React from 'react';
3
7
  import ReactDOM from 'react-dom';
4
8
  import debug from 'debug';
@@ -21,13 +25,17 @@ export default class RubricElement extends HTMLElement {
21
25
  this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
22
26
  }
23
27
 
24
- validateModel = (nextModel) => {
28
+ updateModelAccordingToReceivedProps = (nextModel) => {
25
29
  const currentModel = {...this._model};
30
+ if (!nextModel) {
31
+ return currentModel;
32
+ }
33
+
26
34
  const validatedModel = nextModel;
27
- const {maxPoints, excludeZero} = validatedModel;
35
+ const { maxPoints, excludeZero } = validatedModel || {};
28
36
 
29
- validatedModel.points = [...validatedModel.points];
30
- validatedModel.sampleAnswers = [...validatedModel.sampleAnswers];
37
+ validatedModel.points = validatedModel.points ? [...validatedModel.points] : [];
38
+ validatedModel.sampleAnswers = validatedModel.sampleAnswers ? [...validatedModel.sampleAnswers] : [];
31
39
 
32
40
  const howManyPointsShouldHave = excludeZero ? maxPoints : maxPoints + 1;
33
41
  const howManyPointsDoesItHave = validatedModel.points.length;
@@ -46,11 +54,8 @@ export default class RubricElement extends HTMLElement {
46
54
  validatedModel.sampleAnswers.push(null);
47
55
  }
48
56
  }
49
-
50
- return validatedModel;
51
- }
52
-
53
- if (howManyPointsDoesItHave > howManyPointsShouldHave) {
57
+ }
58
+ else if (howManyPointsDoesItHave > howManyPointsShouldHave) {
54
59
  if (excludeZeroChanged && excludeZero) {
55
60
  validatedModel.points = validatedModel.points.slice(1);
56
61
  validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(1);
@@ -65,7 +70,7 @@ export default class RubricElement extends HTMLElement {
65
70
  }
66
71
 
67
72
  set model(m) {
68
- this._model = this.validateModel(modelWithDefaults(m));
73
+ this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
69
74
  this._render();
70
75
  }
71
76
 
@@ -75,7 +80,7 @@ export default class RubricElement extends HTMLElement {
75
80
  }
76
81
 
77
82
  onModelChanged(m) {
78
- this._model = this.validateModel(m);
83
+ this._model = this.updateModelAccordingToReceivedProps(m);
79
84
  this._render();
80
85
  this.dispatchEvent(new ModelUpdatedEvent(this._model, false));
81
86
  }
@@ -90,6 +95,14 @@ export default class RubricElement extends HTMLElement {
90
95
  this._render();
91
96
  };
92
97
 
98
+ insertImage(handler) {
99
+ this.dispatchEvent(new InsertImageEvent(handler));
100
+ }
101
+
102
+ onDeleteImage(src, done) {
103
+ this.dispatchEvent(new DeleteImageEvent(src, done));
104
+ }
105
+
93
106
  connectedCallback() {
94
107
  this._render();
95
108
  }
@@ -102,6 +115,10 @@ export default class RubricElement extends HTMLElement {
102
115
  configuration: this._configuration,
103
116
  onModelChanged: this.onModelChanged,
104
117
  onConfigurationChanged: this.onConfigurationChanged,
118
+ imageSupport: {
119
+ add: this.insertImage.bind(this),
120
+ delete: this.onDeleteImage.bind(this),
121
+ },
105
122
  });
106
123
 
107
124
  ReactDOM.render(element, this);
@@ -19,7 +19,7 @@ class Main extends React.Component {
19
19
  };
20
20
 
21
21
  render() {
22
- const { model, configuration, onConfigurationChanged, onModelChanged } = this.props || {};
22
+ const { model, configuration, onConfigurationChanged, onModelChanged, imageSupport } = this.props || {};
23
23
  const {
24
24
  baseInputConfiguration = {},
25
25
  contentDimensions = {},
@@ -64,6 +64,7 @@ class Main extends React.Component {
64
64
  groups={{
65
65
  Properties: panelProperties,
66
66
  }}
67
+ imageSupport={imageSupport}
67
68
  />
68
69
  }
69
70
  >
@@ -75,6 +76,7 @@ class Main extends React.Component {
75
76
  mathMlOptions={mathMlOptions}
76
77
  rubricless={rubricless}
77
78
  pluginOpts={baseInputConfiguration}
79
+ imageSupport={imageSupport}
78
80
  />
79
81
  </div>
80
82
  </layout.ConfigLayout>
@@ -104,7 +104,7 @@ export const PointConfig = withStyles((theme) => ({
104
104
  paddingTop: theme.spacing.unit,
105
105
  },
106
106
  }))((props) => {
107
- const { points, content, classes, sampleAnswer, mathMlOptions = {}, error, pluginOpts = {}, excludeZero } = props;
107
+ const { points, content, classes, sampleAnswer, mathMlOptions = {}, error, pluginOpts = {}, excludeZero, imageSupport = {}, } = props;
108
108
  const pointsCount = excludeZero ? points + 1 : points;
109
109
  const pointsLabel = `${pointsCount} ${pointsCount <= 1 ? 'pt' : 'pts'}`;
110
110
  const showSampleAnswer = checkSampleAnswer(sampleAnswer);
@@ -124,6 +124,7 @@ export const PointConfig = withStyles((theme) => ({
124
124
  markup={content}
125
125
  onChange={props.onChange}
126
126
  mathMlOptions={mathMlOptions}
127
+ imageSupport={imageSupport}
127
128
  />
128
129
  <PointMenu
129
130
  classes={{
@@ -145,6 +146,7 @@ export const PointConfig = withStyles((theme) => ({
145
146
  pluginProps={pluginOpts}
146
147
  onChange={props.onSampleChange}
147
148
  mathMlOptions={mathMlOptions}
149
+ imageSupport={imageSupport}
148
150
  />
149
151
  </div>
150
152
  )}
@@ -161,6 +163,10 @@ export class RawAuthoring extends React.Component {
161
163
  pluginOpts: PropTypes.object,
162
164
  rubricless: PropTypes.bool,
163
165
  onChange: PropTypes.func,
166
+ imageSupport: PropTypes.shape({
167
+ add: PropTypes.func.isRequired,
168
+ delete: PropTypes.func.isRequired,
169
+ }),
164
170
  };
165
171
 
166
172
  static defaultProps = {};
@@ -236,6 +242,7 @@ export class RawAuthoring extends React.Component {
236
242
  config = {},
237
243
  rubricless = false,
238
244
  pluginOpts = {},
245
+ imageSupport = {},
239
246
  } = this.props;
240
247
  let {
241
248
  excludeZeroEnabled = true,
@@ -267,6 +274,7 @@ export class RawAuthoring extends React.Component {
267
274
  value={maxPointsValue}
268
275
  onChange={this.changeMaxPoints}
269
276
  pluginOpts={pluginOpts}
277
+ imageSupport={imageSupport}
270
278
  />
271
279
  )}
272
280
  {excludeZeroEnabled && (
@@ -288,6 +296,7 @@ export class RawAuthoring extends React.Component {
288
296
  disableUnderline
289
297
  languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
290
298
  mathMlOptions={mathMlOptions}
299
+ imageSupport={imageSupport}
291
300
  />
292
301
  </InputContainer>
293
302
  )}
@@ -320,6 +329,7 @@ export class RawAuthoring extends React.Component {
320
329
  onMenuChange={(clickedItem) => this.onPointMenuChange(index, clickedItem)}
321
330
  mathMlOptions={mathMlOptions}
322
331
  pluginOpts={pluginOpts}
332
+ imageSupport={imageSupport}
323
333
  excludeZero={value.excludeZero}
324
334
  />
325
335
  </div>
@@ -369,7 +379,7 @@ const styles = (theme) => ({
369
379
  const StyledRawAuthoring = withStyles(styles)(RawAuthoring);
370
380
 
371
381
  const Reverse = (props) => {
372
- const { rubricless = false, config = {}, pluginOpts = {} } = props || {};
382
+ const { rubricless = false, config = {}, pluginOpts = {}, imageSupport = {} } = props || {};
373
383
  const points = Array.from(props.value.points || []).reverse();
374
384
  let sampleAnswers = Array.from(props.value.sampleAnswers || []).reverse();
375
385
 
@@ -396,6 +406,7 @@ const Reverse = (props) => {
396
406
  onChange={onChange}
397
407
  rubricless={rubricless}
398
408
  pluginOpts={pluginOpts}
409
+ imageSupport={imageSupport}
399
410
  />
400
411
  );
401
412
  };
@@ -407,6 +418,10 @@ Reverse.propTypes = {
407
418
  rubricless: PropTypes.bool,
408
419
  getIndex: PropTypes.func,
409
420
  onChange: PropTypes.func,
421
+ imageSupport: PropTypes.shape({
422
+ add: PropTypes.func.isRequired,
423
+ delete: PropTypes.func.isRequired,
424
+ }),
410
425
  };
411
426
 
412
427
  export default Reverse;
@@ -7,7 +7,7 @@
7
7
  "test": "./node_modules/.bin/jest"
8
8
  },
9
9
  "dependencies": {
10
- "@pie-lib/pie-toolbox": "1.13.1",
10
+ "@pie-lib/pie-toolbox": "1.15.0",
11
11
  "lodash": "^4.17.15"
12
12
  }
13
13
  }
@@ -1,4 +1,4 @@
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.6.1/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.7.1/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@4.0.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) {
@@ -41925,7 +41925,7 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
41925
41925
  }
41926
41926
  };
41927
41927
  })(function (props) {
41928
- var points = props.points, content = props.content, classes = props.classes, sampleAnswer = props.sampleAnswer, _props$mathMlOptions = props.mathMlOptions, mathMlOptions = _props$mathMlOptions === void 0 ? {} : _props$mathMlOptions, error = props.error, _props$pluginOpts = props.pluginOpts, pluginOpts = _props$pluginOpts === void 0 ? {} : _props$pluginOpts, excludeZero = props.excludeZero;
41928
+ var points = props.points, content = props.content, classes = props.classes, sampleAnswer = props.sampleAnswer, _props$mathMlOptions = props.mathMlOptions, mathMlOptions = _props$mathMlOptions === void 0 ? {} : _props$mathMlOptions, error = props.error, _props$pluginOpts = props.pluginOpts, pluginOpts = _props$pluginOpts === void 0 ? {} : _props$pluginOpts, excludeZero = props.excludeZero, _props$imageSupport = props.imageSupport, imageSupport = _props$imageSupport === void 0 ? {} : _props$imageSupport;
41929
41929
  var pointsCount = excludeZero ? points + 1 : points;
41930
41930
  var pointsLabel = ("").concat(pointsCount, " ").concat(pointsCount <= 1 ? 'pt' : 'pts');
41931
41931
  var showSampleAnswer = checkSampleAnswer(sampleAnswer);
@@ -41944,7 +41944,8 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
41944
41944
  pluginProps: pluginOpts,
41945
41945
  markup: content,
41946
41946
  onChange: props.onChange,
41947
- mathMlOptions: mathMlOptions
41947
+ mathMlOptions: mathMlOptions,
41948
+ imageSupport: imageSupport
41948
41949
  }), _react["default"].createElement(_pointMenu["default"], {
41949
41950
  classes: {
41950
41951
  icon: classes.pointMenu
@@ -41963,7 +41964,8 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
41963
41964
  markup: sampleAnswer,
41964
41965
  pluginProps: pluginOpts,
41965
41966
  onChange: props.onSampleChange,
41966
- mathMlOptions: mathMlOptions
41967
+ mathMlOptions: mathMlOptions,
41968
+ imageSupport: imageSupport
41967
41969
  })));
41968
41970
  });
41969
41971
  exports.PointConfig = PointConfig;
@@ -42035,7 +42037,7 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
42035
42037
  key: "render",
42036
42038
  value: function render() {
42037
42039
  var _this2 = this;
42038
- var _this$props6 = this.props, classes = _this$props6.classes, className = _this$props6.className, value = _this$props6.value, _this$props6$mathMlOp = _this$props6.mathMlOptions, mathMlOptions = _this$props6$mathMlOp === void 0 ? {} : _this$props6$mathMlOp, _this$props6$config = _this$props6.config, config = _this$props6$config === void 0 ? {} : _this$props6$config, _this$props6$rubricle = _this$props6.rubricless, rubricless = _this$props6$rubricle === void 0 ? false : _this$props6$rubricle, _this$props6$pluginOp = _this$props6.pluginOpts, pluginOpts = _this$props6$pluginOp === void 0 ? {} : _this$props6$pluginOp;
42040
+ var _this$props6 = this.props, classes = _this$props6.classes, className = _this$props6.className, value = _this$props6.value, _this$props6$mathMlOp = _this$props6.mathMlOptions, mathMlOptions = _this$props6$mathMlOp === void 0 ? {} : _this$props6$mathMlOp, _this$props6$config = _this$props6.config, config = _this$props6$config === void 0 ? {} : _this$props6$config, _this$props6$rubricle = _this$props6.rubricless, rubricless = _this$props6$rubricle === void 0 ? false : _this$props6$rubricle, _this$props6$pluginOp = _this$props6.pluginOpts, pluginOpts = _this$props6$pluginOp === void 0 ? {} : _this$props6$pluginOp, _this$props6$imageSup = _this$props6.imageSupport, imageSupport = _this$props6$imageSup === void 0 ? {} : _this$props6$imageSup;
42039
42041
  var _ref = value || ({}), _ref$excludeZeroEnabl = _ref.excludeZeroEnabled, excludeZeroEnabled = _ref$excludeZeroEnabl === void 0 ? true : _ref$excludeZeroEnabl, _ref$maxPointsEnabled = _ref.maxPointsEnabled, maxPointsEnabled = _ref$maxPointsEnabled === void 0 ? true : _ref$maxPointsEnabled, _ref$errors = _ref.errors, errors = _ref$errors === void 0 ? {} : _ref$errors, _ref$rubriclessInstru = _ref.rubriclessInstructionEnabled, rubriclessInstructionEnabled = _ref$rubriclessInstru === void 0 ? false : _ref$rubriclessInstru, _ref$maxPoints = _ref.maxPoints, maxPoints = _ref$maxPoints === void 0 ? 10 : _ref$maxPoints;
42040
42042
  var _ref2 = config || ({}), _ref2$rubriclessInstr = _ref2.rubriclessInstruction, rubriclessInstruction = _ref2$rubriclessInstr === void 0 ? {} : _ref2$rubriclessInstr, _ref2$maxMaxPoints = _ref2.maxMaxPoints, maxMaxPoints = _ref2$maxMaxPoints === void 0 ? 10 : _ref2$maxMaxPoints;
42041
42043
  var _ref3 = errors || ({}), pointsDescriptorsErrors = _ref3.pointsDescriptorsErrors;
@@ -42054,7 +42056,8 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
42054
42056
  max: maxMaxPoints < 100 ? maxMaxPoints : 100,
42055
42057
  value: maxPointsValue,
42056
42058
  onChange: this.changeMaxPoints,
42057
- pluginOpts: pluginOpts
42059
+ pluginOpts: pluginOpts,
42060
+ imageSupport: imageSupport
42058
42061
  }), excludeZeroEnabled && _react["default"].createElement(_FormControlLabel["default"], {
42059
42062
  label: "Exclude zeros",
42060
42063
  control: _react["default"].createElement(_Checkbox["default"], {
@@ -42076,7 +42079,8 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
42076
42079
  }, {
42077
42080
  language: 'special'
42078
42081
  }],
42079
- mathMlOptions: mathMlOptions
42082
+ mathMlOptions: mathMlOptions,
42083
+ imageSupport: imageSupport
42080
42084
  })), _react["default"].createElement("div", {
42081
42085
  className: rubricless ? classes.rubricless : classes.container
42082
42086
  }, _react["default"].createElement(_reactBeautifulDnd.DragDropContext, {
@@ -42111,6 +42115,7 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
42111
42115
  },
42112
42116
  mathMlOptions: mathMlOptions,
42113
42117
  pluginOpts: pluginOpts,
42118
+ imageSupport: imageSupport,
42114
42119
  excludeZero: value.excludeZero
42115
42120
  }));
42116
42121
  });
@@ -42128,7 +42133,11 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
42128
42133
  config: _propTypes["default"].object,
42129
42134
  pluginOpts: _propTypes["default"].object,
42130
42135
  rubricless: _propTypes["default"].bool,
42131
- onChange: _propTypes["default"].func
42136
+ onChange: _propTypes["default"].func,
42137
+ imageSupport: _propTypes["default"].shape({
42138
+ add: _propTypes["default"].func.isRequired,
42139
+ "delete": _propTypes["default"].func.isRequired
42140
+ })
42132
42141
  });
42133
42142
  (0, _defineProperty2["default"])(RawAuthoring, "defaultProps", {});
42134
42143
  var styles = function styles(theme) {
@@ -42161,7 +42170,7 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
42161
42170
  };
42162
42171
  var StyledRawAuthoring = (0, _styles.withStyles)(styles)(RawAuthoring);
42163
42172
  var Reverse = function Reverse(props) {
42164
- var _ref4 = props || ({}), _ref4$rubricless = _ref4.rubricless, rubricless = _ref4$rubricless === void 0 ? false : _ref4$rubricless, _ref4$config = _ref4.config, config = _ref4$config === void 0 ? {} : _ref4$config, _ref4$pluginOpts = _ref4.pluginOpts, pluginOpts = _ref4$pluginOpts === void 0 ? {} : _ref4$pluginOpts;
42173
+ var _ref4 = props || ({}), _ref4$rubricless = _ref4.rubricless, rubricless = _ref4$rubricless === void 0 ? false : _ref4$rubricless, _ref4$config = _ref4.config, config = _ref4$config === void 0 ? {} : _ref4$config, _ref4$pluginOpts = _ref4.pluginOpts, pluginOpts = _ref4$pluginOpts === void 0 ? {} : _ref4$pluginOpts, _ref4$imageSupport = _ref4.imageSupport, imageSupport = _ref4$imageSupport === void 0 ? {} : _ref4$imageSupport;
42165
42174
  var points = Array.from(props.value.points || []).reverse();
42166
42175
  var sampleAnswers = Array.from(props.value.sampleAnswers || []).reverse();
42167
42176
  if (points.length > sampleAnswers.length) {
@@ -42184,7 +42193,8 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
42184
42193
  config: config,
42185
42194
  onChange: onChange,
42186
42195
  rubricless: rubricless,
42187
- pluginOpts: pluginOpts
42196
+ pluginOpts: pluginOpts,
42197
+ imageSupport: imageSupport
42188
42198
  });
42189
42199
  };
42190
42200
  Reverse.propTypes = {
@@ -42193,7 +42203,11 @@ const require$$32 = _dll_pie_lib__pie_toolbox_config_ui;
42193
42203
  pluginOpts: _propTypes["default"].object,
42194
42204
  rubricless: _propTypes["default"].bool,
42195
42205
  getIndex: _propTypes["default"].func,
42196
- onChange: _propTypes["default"].func
42206
+ onChange: _propTypes["default"].func,
42207
+ imageSupport: _propTypes["default"].shape({
42208
+ add: _propTypes["default"].func.isRequired,
42209
+ "delete": _propTypes["default"].func.isRequired
42210
+ })
42197
42211
  };
42198
42212
  var _default = Reverse;
42199
42213
  exports["default"] = _default;
@@ -42319,7 +42333,7 @@ const require$$12$1 = _dll_pie_lib__pie_toolbox_config_ui;
42319
42333
  (0, _createClass2["default"])(Main, [{
42320
42334
  key: "render",
42321
42335
  value: function render() {
42322
- var _ref3 = this.props || ({}), model = _ref3.model, configuration = _ref3.configuration, onConfigurationChanged = _ref3.onConfigurationChanged, onModelChanged = _ref3.onModelChanged;
42336
+ var _ref3 = this.props || ({}), model = _ref3.model, configuration = _ref3.configuration, onConfigurationChanged = _ref3.onConfigurationChanged, onModelChanged = _ref3.onModelChanged, imageSupport = _ref3.imageSupport;
42323
42337
  var _ref4 = configuration || ({}), _ref4$baseInputConfig = _ref4.baseInputConfiguration, baseInputConfiguration = _ref4$baseInputConfig === void 0 ? {} : _ref4$baseInputConfig, _ref4$contentDimensio = _ref4.contentDimensions, contentDimensions = _ref4$contentDimensio === void 0 ? {} : _ref4$contentDimensio, settingsPanelDisabled = _ref4.settingsPanelDisabled, _ref4$showExcludeZero = _ref4.showExcludeZero, showExcludeZero = _ref4$showExcludeZero === void 0 ? {} : _ref4$showExcludeZero, _ref4$showMaxPoint = _ref4.showMaxPoint, showMaxPoint = _ref4$showMaxPoint === void 0 ? {} : _ref4$showMaxPoint, _ref4$mathMlOptions = _ref4.mathMlOptions, mathMlOptions = _ref4$mathMlOptions === void 0 ? {} : _ref4$mathMlOptions, _ref4$rubricless = _ref4.rubricless, rubricless = _ref4$rubricless === void 0 ? false : _ref4$rubricless, rubriclessInstruction = _ref4.rubriclessInstruction, width = _ref4.width;
42324
42338
  var value = this.verifyRubriclessModel(model, configuration);
42325
42339
  var panelProperties = {
@@ -42341,7 +42355,8 @@ const require$$12$1 = _dll_pie_lib__pie_toolbox_config_ui;
42341
42355
  pluginOpts: getPluginProps(rubriclessInstruction === null || rubriclessInstruction === void 0 ? void 0 : rubriclessInstruction.inputConfiguration),
42342
42356
  groups: {
42343
42357
  Properties: panelProperties
42344
- }
42358
+ },
42359
+ imageSupport: imageSupport
42345
42360
  })
42346
42361
  }, _react["default"].createElement("div", {
42347
42362
  style: {
@@ -42353,7 +42368,8 @@ const require$$12$1 = _dll_pie_lib__pie_toolbox_config_ui;
42353
42368
  onChange: onModelChanged,
42354
42369
  mathMlOptions: mathMlOptions,
42355
42370
  rubricless: rubricless,
42356
- pluginOpts: baseInputConfiguration
42371
+ pluginOpts: baseInputConfiguration,
42372
+ imageSupport: imageSupport
42357
42373
  })));
42358
42374
  }
42359
42375
  }]);
@@ -42504,12 +42520,15 @@ const require$$13 = _dll_debug;
42504
42520
  var _this;
42505
42521
  (0, _classCallCheck2["default"])(this, RubricElement);
42506
42522
  _this = _super.call(this);
42507
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "validateModel", function (nextModel) {
42523
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateModelAccordingToReceivedProps", function (nextModel) {
42508
42524
  var currentModel = _objectSpread({}, _this._model);
42525
+ if (!nextModel) {
42526
+ return currentModel;
42527
+ }
42509
42528
  var validatedModel = nextModel;
42510
- var maxPoints = validatedModel.maxPoints, excludeZero = validatedModel.excludeZero;
42511
- validatedModel.points = (0, _toConsumableArray2["default"])(validatedModel.points);
42512
- validatedModel.sampleAnswers = (0, _toConsumableArray2["default"])(validatedModel.sampleAnswers);
42529
+ var _ref = validatedModel || ({}), maxPoints = _ref.maxPoints, excludeZero = _ref.excludeZero;
42530
+ validatedModel.points = validatedModel.points ? (0, _toConsumableArray2["default"])(validatedModel.points) : [];
42531
+ validatedModel.sampleAnswers = validatedModel.sampleAnswers ? (0, _toConsumableArray2["default"])(validatedModel.sampleAnswers) : [];
42513
42532
  var howManyPointsShouldHave = excludeZero ? maxPoints : maxPoints + 1;
42514
42533
  var howManyPointsDoesItHave = validatedModel.points.length;
42515
42534
  var excludeZeroChanged = (currentModel === null || currentModel === void 0 ? void 0 : currentModel.excludeZero) !== (nextModel === null || nextModel === void 0 ? void 0 : nextModel.excludeZero);
@@ -42525,9 +42544,7 @@ const require$$13 = _dll_debug;
42525
42544
  validatedModel.sampleAnswers.push(null);
42526
42545
  }
42527
42546
  }
42528
- return validatedModel;
42529
- }
42530
- if (howManyPointsDoesItHave > howManyPointsShouldHave) {
42547
+ } else if (howManyPointsDoesItHave > howManyPointsShouldHave) {
42531
42548
  if (excludeZeroChanged && excludeZero) {
42532
42549
  validatedModel.points = validatedModel.points.slice(1);
42533
42550
  validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(1);
@@ -42556,7 +42573,7 @@ const require$$13 = _dll_debug;
42556
42573
  (0, _createClass2["default"])(RubricElement, [{
42557
42574
  key: "model",
42558
42575
  set: function set(m) {
42559
- this._model = this.validateModel(modelWithDefaults(m));
42576
+ this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
42560
42577
  this._render();
42561
42578
  }
42562
42579
  }, {
@@ -42568,10 +42585,20 @@ const require$$13 = _dll_debug;
42568
42585
  }, {
42569
42586
  key: "onModelChanged",
42570
42587
  value: function onModelChanged(m) {
42571
- this._model = this.validateModel(m);
42588
+ this._model = this.updateModelAccordingToReceivedProps(m);
42572
42589
  this._render();
42573
42590
  this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model, false));
42574
42591
  }
42592
+ }, {
42593
+ key: "insertImage",
42594
+ value: function insertImage(handler) {
42595
+ this.dispatchEvent(new _pieConfigureEvents.InsertImageEvent(handler));
42596
+ }
42597
+ }, {
42598
+ key: "onDeleteImage",
42599
+ value: function onDeleteImage(src, done) {
42600
+ this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
42601
+ }
42575
42602
  }, {
42576
42603
  key: "connectedCallback",
42577
42604
  value: function connectedCallback() {
@@ -42586,7 +42613,11 @@ const require$$13 = _dll_debug;
42586
42613
  model: this._model,
42587
42614
  configuration: this._configuration,
42588
42615
  onModelChanged: this.onModelChanged,
42589
- onConfigurationChanged: this.onConfigurationChanged
42616
+ onConfigurationChanged: this.onConfigurationChanged,
42617
+ imageSupport: {
42618
+ add: this.insertImage.bind(this),
42619
+ "delete": this.onDeleteImage.bind(this)
42620
+ }
42590
42621
  });
42591
42622
  _reactDom["default"].render(element, this);
42592
42623
  }
package/module/element.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.6.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.7.1/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.0.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) {
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/rubric@3.8.1</title>
5
+ <title>@pie-element/rubric@3.8.2</title>
6
6
  <script
7
7
  type="module"
8
8
  src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@pie-element/rubric",
3
- "version": "3.8.1",
3
+ "version": "3.8.2",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.6.1"
7
+ "version": "1.7.1"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/rubric@3.8.1</title>
5
+ <title>@pie-element/rubric@3.8.2</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"
package/module/print.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_lodash, _dll_pie_lib__pie_toolbox_math_rendering_accessible, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.6.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_lodash, _dll_pie_lib__pie_toolbox_math_rendering_accessible, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.7.1/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.0.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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/rubric",
3
- "version": "3.8.2-next.7+4853068d6",
3
+ "version": "3.8.3-next.10+5fa3e462b",
4
4
  "main": "lib/index.js",
5
5
  "module": "src/index.js",
6
6
  "description": "Rubric Scoring Interaction",
@@ -10,12 +10,12 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@material-ui/core": "^3.9.2",
13
- "@pie-lib/pie-toolbox": "1.13.1",
13
+ "@pie-lib/pie-toolbox": "1.15.0",
14
14
  "prop-types": "^15.7.2"
15
15
  },
16
16
  "author": "pie framework developers",
17
17
  "license": "ISC",
18
- "gitHead": "4853068d6d7e236c696288361b42ede1923a6fd5",
18
+ "gitHead": "5fa3e462b8fe802214f4540b571f9ef9213356d0",
19
19
  "scripts": {
20
20
  "postpublish": "../../scripts/postpublish"
21
21
  },