@pie-element/rubric 3.5.1 → 3.5.3-next.4

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.5.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric@3.5.1...@pie-element/rubric@3.5.2) (2024-03-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * don't push a value for empty sample answer ([0628eee](https://github.com/pie-framework/pie-elements/commit/0628eeeece526b11115e5608675f7846b2a73703))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.5.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric@3.5.0...@pie-element/rubric@3.5.1) (2024-03-22)
7
18
 
8
19
 
@@ -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.5.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-configure@3.5.1...@pie-element/rubric-configure@3.5.2) (2024-03-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * don't push a value for empty sample answer ([0628eee](https://github.com/pie-framework/pie-elements/commit/0628eeeece526b11115e5608675f7846b2a73703))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.5.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-configure@3.5.0...@pie-element/rubric-configure@3.5.1) (2024-03-22)
7
18
 
8
19
 
@@ -79,13 +79,13 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
79
79
  if (howManyPointsDoesItHave < howManyPointsShouldHave) {
80
80
  if (excludeZeroChanged && !excludeZero) {
81
81
  validatedModel.points = [''].concat((0, _toConsumableArray2["default"])(validatedModel.points));
82
- validatedModel.sampleAnswers = [''].concat((0, _toConsumableArray2["default"])(validatedModel.sampleAnswers));
82
+ validatedModel.sampleAnswers = [null].concat((0, _toConsumableArray2["default"])(validatedModel.sampleAnswers));
83
83
  }
84
84
 
85
85
  if (maxPointsChanged) {
86
86
  for (var i = 0; i < howManyPointsShouldHave - howManyPointsDoesItHave; i++) {
87
87
  validatedModel.points.push('');
88
- validatedModel.sampleAnswers.push('');
88
+ validatedModel.sampleAnswers.push(null);
89
89
  }
90
90
  }
91
91
 
@@ -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","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,CAAD;AAAA,yCAAYC,qBAASC,KAArB,GAA+BF,CAA/B;AAAA,CAA1B;;AACA,IAAMG,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACC,CAAD;AAAA,yCAAYH,qBAASI,aAArB,GAAuCD,CAAvC;AAAA,CAAlC;;IAEqBE,a;;;;;AAGjB,2BAAc;AAAA;;AAAA;AACV;AADU,sGASE,UAACC,SAAD,EAAe;AAC3B,UAAMC,YAAY,qBAAO,MAAKC,MAAZ,CAAlB;;AACA,UAAMC,cAAc,GAAGH,SAAvB;AACA,UAAOI,SAAP,GAAiCD,cAAjC,CAAOC,SAAP;AAAA,UAAkBC,WAAlB,GAAiCF,cAAjC,CAAkBE,WAAlB;AAEAF,MAAAA,cAAc,CAACG,MAAf,uCAA4BH,cAAc,CAACG,MAA3C;AACAH,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AACA,WAAKyB,OAAL;;AACA,WAAKM,aAAL,CAAmB,IAAIC,qCAAJ,CAAsB,KAAKvB,MAA3B,EAAmC,KAAnC,CAAnB;AACH;;;WAYD,6BAAoB;AAChB,WAAKgB,OAAL;AACH;;;WAED,mBAAU;AACNQ,MAAAA,OAAO,CAACN,GAAR,CAAY,WAAZ,EAAyB,KAAKlB,MAA9B;;AACA,UAAI,KAAKA,MAAT,EAAiB;AACb,YAAIyB,OAAO,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACpCnC,UAAAA,KAAK,EAAE,KAAKO,MADwB;AAEpCJ,UAAAA,aAAa,EAAE,KAAKkB,cAFgB;AAGpCC,UAAAA,cAAc,EAAE,KAAKA,cAHe;AAIpCK,UAAAA,sBAAsB,EAAE,KAAKA;AAJO,SAA1B,CAAd;;AAOAS,6BAASC,MAAT,CAAgBL,OAAhB,EAAyB,IAAzB;AACH;AACJ;;;kDAjGsCM,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 = ['', ...validatedModel.sampleAnswers];\n }\n if (maxPointsChanged) {\n for (let i = 0; i < howManyPointsShouldHave - howManyPointsDoesItHave; i++) {\n validatedModel.points.push('');\n validatedModel.sampleAnswers.push('');\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","validateModel","dispatchEvent","ModelUpdatedEvent","console","element","React","createElement","Main","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,CAAD;AAAA,yCAAYC,qBAASC,KAArB,GAA+BF,CAA/B;AAAA,CAA1B;;AACA,IAAMG,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACC,CAAD;AAAA,yCAAYH,qBAASI,aAArB,GAAuCD,CAAvC;AAAA,CAAlC;;IAEqBE,a;;;;;AAGjB,2BAAc;AAAA;;AAAA;AACV;AADU,sGASE,UAACC,SAAD,EAAe;AAC3B,UAAMC,YAAY,qBAAO,MAAKC,MAAZ,CAAlB;;AACA,UAAMC,cAAc,GAAGH,SAAvB;AACA,UAAOI,SAAP,GAAiCD,cAAjC,CAAOC,SAAP;AAAA,UAAkBC,WAAlB,GAAiCF,cAAjC,CAAkBE,WAAlB;AAEAF,MAAAA,cAAc,CAACG,MAAf,uCAA4BH,cAAc,CAACG,MAA3C;AACAH,MAAAA,cAAc,CAACI,aAAf,uCAAmCJ,cAAc,CAACI,aAAlD;AAEA,UAAMC,uBAAuB,GAAGH,WAAW,GAAGD,SAAH,GAAeA,SAAS,GAAG,CAAtE;AACA,UAAMK,uBAAuB,GAAGN,cAAc,CAACG,MAAf,CAAsBI,MAAtD;AAEA,UAAMC,kBAAkB,GAAG,CAAAV,YAAY,SAAZ,IAAAA,YAAY,WAAZ,YAAAA,YAAY,CAAEI,WAAd,OAA8BL,SAA9B,aAA8BA,SAA9B,uBAA8BA,SAAS,CAAEK,WAAzC,CAA3B;AACA,UAAMO,gBAAgB,GAAG,CAAAX,YAAY,SAAZ,IAAAA,YAAY,WAAZ,YAAAA,YAAY,CAA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,EAAE,KAAKA,cAHe;AAIpCK,UAAAA,sBAAsB,EAAE,KAAKA;AAJO,SAA1B,CAAd;;AAOAS,6BAASC,MAAT,CAAgBL,OAAhB,EAAyB,IAAzB;AACH;AACJ;;;kDAjGsCM,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,14 +1,14 @@
1
1
  {
2
2
  "name": "@pie-element/rubric-configure",
3
3
  "private": true,
4
- "version": "3.5.1",
4
+ "version": "3.5.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.11.1",
11
+ "@pie-lib/pie-toolbox": "1.12.0",
12
12
  "debug": "^4.1.1",
13
13
  "react": "^16.8.6",
14
14
  "react-dom": "^16.8.6"
@@ -38,12 +38,12 @@ export default class RubricElement extends HTMLElement {
38
38
  if (howManyPointsDoesItHave < howManyPointsShouldHave) {
39
39
  if (excludeZeroChanged && !excludeZero) {
40
40
  validatedModel.points = ['', ...validatedModel.points];
41
- validatedModel.sampleAnswers = ['', ...validatedModel.sampleAnswers];
41
+ validatedModel.sampleAnswers = [null, ...validatedModel.sampleAnswers];
42
42
  }
43
43
  if (maxPointsChanged) {
44
44
  for (let i = 0; i < howManyPointsShouldHave - howManyPointsDoesItHave; i++) {
45
45
  validatedModel.points.push('');
46
- validatedModel.sampleAnswers.push('');
46
+ validatedModel.sampleAnswers.push(null);
47
47
  }
48
48
  }
49
49
 
@@ -7,7 +7,7 @@
7
7
  "test": "./node_modules/.bin/jest"
8
8
  },
9
9
  "dependencies": {
10
- "@pie-lib/pie-toolbox": "1.11.1",
10
+ "@pie-lib/pie-toolbox": "1.12.0",
11
11
  "lodash": "^4.17.15"
12
12
  }
13
13
  }
package/lib/print.js CHANGED
@@ -31,7 +31,7 @@ var _debounce = _interopRequireDefault(require("lodash/debounce"));
31
31
 
32
32
  var _main = _interopRequireDefault(require("./main"));
33
33
 
34
- var _mathRendering = require("@pie-lib/pie-toolbox/math-rendering");
34
+ var _mathRenderingAccessible = require("@pie-lib/pie-toolbox/math-rendering-accessible");
35
35
 
36
36
  var _debug = _interopRequireDefault(require("debug"));
37
37
 
@@ -79,7 +79,7 @@ var RubricPrint = /*#__PURE__*/function (_HTMLElement) {
79
79
 
80
80
  _reactDom["default"].render(element, (0, _assertThisInitialized2["default"])(_this), function () {
81
81
  log('render complete - render math');
82
- (0, _mathRendering.renderMath)((0, _assertThisInitialized2["default"])(_this));
82
+ (0, _mathRenderingAccessible.renderMath)((0, _assertThisInitialized2["default"])(_this));
83
83
  });
84
84
  } else {
85
85
  log('skip');
package/lib/print.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/print.js"],"names":["log","preparePrintModel","model","opts","instr","role","value","mode","animationsDisabled","RubricPrint","_options","_model","_session","_rerender","printModel","element","React","createElement","Main","ReactDOM","render","leading","trailing","o","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0BAAN,CAAZ;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;;;kDAtCiBY,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering';\nimport debug from 'debug';\n\nconst log = debug('pie-element:rubric:print');\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n if (!instr) {\n return {};\n }\n\n model.value = { ...model };\n model.mode = 'evaluate';\n model.animationsDisabled = true;\n\n return model;\n};\n\nexport default class RubricPrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n ...printModel,\n });\n\n ReactDOM.render(element, this, () => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}
1
+ {"version":3,"sources":["../src/print.js"],"names":["log","preparePrintModel","model","opts","instr","role","value","mode","animationsDisabled","RubricPrint","_options","_model","_session","_rerender","printModel","element","React","createElement","Main","ReactDOM","render","leading","trailing","o","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0BAAN,CAAZ;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAL,KAAc,YAA5B;;AAEA,MAAI,CAACD,KAAL,EAAY;AACV,WAAO,EAAP;AACD;;AAEDF,EAAAA,KAAK,CAACI,KAAN,qBAAmBJ,KAAnB;AACAA,EAAAA,KAAK,CAACK,IAAN,GAAa,UAAb;AACAL,EAAAA,KAAK,CAACM,kBAAN,GAA2B,IAA3B;AAEA,SAAON,KAAP;AACD,CAZD;;IAcqBO,W;;;;;AACnB,yBAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,QAAL,GAAgB,IAAhB;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,EAAhB;AACA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKF,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAME,UAAU,GAAGb,iBAAiB,CAAC,MAAKU,MAAN,EAAc,MAAKD,QAAnB,CAApC;;AAEA,YAAMK,OAAO,GACX,MAAKL,QAAL,iBACAM,kBAAMC,aAAN,CAAoBC,gBAApB,oBACKJ,UADL,EAFF;;AAMAK,6BAASC,MAAT,CAAgBL,OAAhB,kDAA+B,YAAM;AACnCf,UAAAA,GAAG,CAAC,+BAAD,CAAH;AACA;AACD,SAHD;AAID,OAbD,MAaO;AACLA,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KAlBc,EAmBf,EAnBe,EAoBf;AAAEqB,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KApBe,CAAjB;AALY;AA2Bb;;;;SACD,aAAYC,CAAZ,EAAe;AACb,WAAKb,QAAL,GAAgBa,CAAhB;AACD;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKb,MAAL,GAAca,CAAd;;AACA,WAAKX,SAAL;AACD;;;WAED,6BAAoB,CAAE;;;kDAtCiBY,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering-accessible';\nimport debug from 'debug';\n\nconst log = debug('pie-element:rubric:print');\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n if (!instr) {\n return {};\n }\n\n model.value = { ...model };\n model.mode = 'evaluate';\n model.animationsDisabled = true;\n\n return model;\n};\n\nexport default class RubricPrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n ...printModel,\n });\n\n ReactDOM.render(element, this, () => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}
@@ -42517,12 +42517,12 @@ const require$$13 = _dll_debug;
42517
42517
  if (howManyPointsDoesItHave < howManyPointsShouldHave) {
42518
42518
  if (excludeZeroChanged && !excludeZero) {
42519
42519
  validatedModel.points = [''].concat((0, _toConsumableArray2["default"])(validatedModel.points));
42520
- validatedModel.sampleAnswers = [''].concat((0, _toConsumableArray2["default"])(validatedModel.sampleAnswers));
42520
+ validatedModel.sampleAnswers = [null].concat((0, _toConsumableArray2["default"])(validatedModel.sampleAnswers));
42521
42521
  }
42522
42522
  if (maxPointsChanged) {
42523
42523
  for (var i = 0; i < howManyPointsShouldHave - howManyPointsDoesItHave; i++) {
42524
42524
  validatedModel.points.push('');
42525
- validatedModel.sampleAnswers.push('');
42525
+ validatedModel.sampleAnswers.push(null);
42526
42526
  }
42527
42527
  }
42528
42528
  return validatedModel;
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.5.0</title>
5
+ <title>@pie-element/rubric@3.5.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/rubric",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-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.5.0</title>
5
+ <title>@pie-element/rubric@3.5.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, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.4.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.4.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) {
@@ -8319,7 +8319,7 @@ var Main = styles$9.withStyles(styles)(Rubric);
8319
8319
  const React = _dll_react;
8320
8320
  const ReactDOM = _dll_react_dom;
8321
8321
  const {debounce: debounce} = _dll_lodash;
8322
- const {renderMath: renderMath} = _dll_pie_lib__pie_toolbox_math_rendering;
8322
+ const {renderMath: renderMath} = _dll_pie_lib__pie_toolbox_math_rendering_accessible;
8323
8323
  const debug = _dll_debug;
8324
8324
  const log = debug('pie-element:rubric:print');
8325
8325
  const preparePrintModel = (model, opts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/rubric",
3
- "version": "3.5.1",
3
+ "version": "3.5.3-next.4+2a433493b",
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.11.1",
13
+ "@pie-lib/pie-toolbox": "1.12.0",
14
14
  "prop-types": "^15.7.2"
15
15
  },
16
16
  "author": "pie framework developers",
17
17
  "license": "ISC",
18
- "gitHead": "d3aedbd26d0879223fc186049e7919ac5e36709c",
18
+ "gitHead": "2a433493bdf64cc41affea82c033300383db1afa",
19
19
  "scripts": {
20
20
  "postpublish": "../../scripts/postpublish"
21
21
  },
package/src/print.js CHANGED
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import debounce from 'lodash/debounce';
4
4
  import Main from './main';
5
- import { renderMath } from '@pie-lib/pie-toolbox/math-rendering';
5
+ import { renderMath } from '@pie-lib/pie-toolbox/math-rendering-accessible';
6
6
  import debug from 'debug';
7
7
 
8
8
  const log = debug('pie-element:rubric:print');