@pie-element/number-line 6.12.1-next.9 → 6.13.0
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 +20 -0
- package/configure/CHANGELOG.md +19 -0
- package/configure/lib/defaults.js +13 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +13 -1
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +7 -3
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +11 -0
- package/controller/lib/index.js +2 -1
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +133 -0
- package/docs/config-schema.json.md +94 -1
- package/docs/pie-schema.json +62 -0
- package/docs/pie-schema.json.md +46 -0
- package/lib/number-line/index.js +14 -3
- package/lib/number-line/index.js.map +1 -1
- package/lib/number-line/point-chooser/index.js +14 -4
- package/lib/number-line/point-chooser/index.js.map +1 -1
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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
|
+
# [6.13.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/number-line@6.12.0...@pie-element/number-line@6.13.0) (2023-06-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update docs ([bc716ee](https://github.com/pie-framework/pie-elements/commit/bc716ee68f0673b391375df9d68904af4110c37a))
|
|
12
|
+
* update libs PD-2722, PD-2827, PD-2832 ([834ecf9](https://github.com/pie-framework/pie-elements/commit/834ecf92cc7204c851c68f0945ad5d52e453c9d0))
|
|
13
|
+
* update pie-libs ([649fb8f](https://github.com/pie-framework/pie-elements/commit/649fb8f535172d76b3ffc676ec53b2726432808c))
|
|
14
|
+
* update pie-libs PD-2150, PD-2795 ([ff6f64a](https://github.com/pie-framework/pie-elements/commit/ff6f64afa6ccaa8a060c986b1637c680e68c62b6))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **number-line:** add translator PD-2795 ([23e78a9](https://github.com/pie-framework/pie-elements/commit/23e78a970805c88d7bad097bebaf170fe69003cc))
|
|
20
|
+
* add mathMlOptions PD-2150 ([0c6984c](https://github.com/pie-framework/pie-elements/commit/0c6984cf042141eac36badfbab1c46d8d42f71ee))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
# [6.12.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/number-line@6.11.3...@pie-element/number-line@6.12.0) (2023-05-23)
|
|
7
27
|
|
|
8
28
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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
|
+
# [5.10.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/number-line-configure@5.9.0...@pie-element/number-line-configure@5.10.0) (2023-06-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update libs PD-2722, PD-2827, PD-2832 ([834ecf9](https://github.com/pie-framework/pie-elements/commit/834ecf92cc7204c851c68f0945ad5d52e453c9d0))
|
|
12
|
+
* update pie-libs ([649fb8f](https://github.com/pie-framework/pie-elements/commit/649fb8f535172d76b3ffc676ec53b2726432808c))
|
|
13
|
+
* update pie-libs PD-2150, PD-2795 ([ff6f64a](https://github.com/pie-framework/pie-elements/commit/ff6f64afa6ccaa8a060c986b1637c680e68c62b6))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **number-line:** add translator PD-2795 ([23e78a9](https://github.com/pie-framework/pie-elements/commit/23e78a970805c88d7bad097bebaf170fe69003cc))
|
|
19
|
+
* add mathMlOptions PD-2150 ([0c6984c](https://github.com/pie-framework/pie-elements/commit/0c6984cf042141eac36badfbab1c46d8d42f71ee))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [5.9.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/number-line-configure@5.8.3...@pie-element/number-line-configure@5.9.0) (2023-05-23)
|
|
7
26
|
|
|
8
27
|
|
|
@@ -62,6 +62,19 @@ var configuration = {
|
|
|
62
62
|
label: 'Spellcheck',
|
|
63
63
|
settings: false,
|
|
64
64
|
enabled: true
|
|
65
|
+
},
|
|
66
|
+
mathMlOptions: {
|
|
67
|
+
mmlOutput: false,
|
|
68
|
+
mmlEditing: false
|
|
69
|
+
},
|
|
70
|
+
language: {
|
|
71
|
+
settings: false,
|
|
72
|
+
label: 'Specify Language',
|
|
73
|
+
enabled: false
|
|
74
|
+
},
|
|
75
|
+
languageChoices: {
|
|
76
|
+
label: 'Language Choices',
|
|
77
|
+
options: []
|
|
65
78
|
}
|
|
66
79
|
};
|
|
67
80
|
exports.configuration = configuration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","correctResponse","graph","domain","min","max","ticks","minor","major","arrows","left","right","maxNumberOfPoints","width","initialType","exhibitOnly","toolbarEditorPosition","availableTypes","PF","LFF","LEF","LFE","LEE","RFN","RFP","REN","REP","initialElements","feedback","correct","type","incorrect","partial","configuration","prompt","settings","label","spellCheck","enabled"],"mappings":";;;;;;AAAO,IAAMA,KAAK,GAAG;AACnBC,EAAAA,eAAe,EAAE,EADE;AAEnBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,GAAG,EAAE,CAAC,CAAR;AAAWC,MAAAA,GAAG,EAAE;AAAhB,KADH;AAELC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,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js"],"names":["model","correctResponse","graph","domain","min","max","ticks","minor","major","arrows","left","right","maxNumberOfPoints","width","initialType","exhibitOnly","toolbarEditorPosition","availableTypes","PF","LFF","LEF","LFE","LEE","RFN","RFP","REN","REP","initialElements","feedback","correct","type","incorrect","partial","configuration","prompt","settings","label","spellCheck","enabled","mathMlOptions","mmlOutput","mmlEditing","language","languageChoices","options"],"mappings":";;;;;;AAAO,IAAMA,KAAK,GAAG;AACnBC,EAAAA,eAAe,EAAE,EADE;AAEnBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,GAAG,EAAE,CAAC,CAAR;AAAWC,MAAAA,GAAG,EAAE;AAAhB,KADH;AAELC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,CADF;AAELC,MAAAA,KAAK,EAAE;AAFF,KAFF;AAMLC,IAAAA,MAAM,EAAE;AACNC,MAAAA,IAAI,EAAE,IADA;AAENC,MAAAA,KAAK,EAAE;AAFD,KANH;AAULC,IAAAA,iBAAiB,EAAE,EAVd;AAWLC,IAAAA,KAAK,EAAE,GAXF;AAYLC,IAAAA,WAAW,EAAE,IAZR;AAaLC,IAAAA,WAAW,EAAE,KAbR;AAcLC,IAAAA,qBAAqB,EAAE,QAdlB;AAeLC,IAAAA,cAAc,EAAE;AACdC,MAAAA,EAAE,EAAE,IADU;AAEdC,MAAAA,GAAG,EAAE,IAFS;AAGdC,MAAAA,GAAG,EAAE,IAHS;AAIdC,MAAAA,GAAG,EAAE,IAJS;AAKdC,MAAAA,GAAG,EAAE,IALS;AAMdC,MAAAA,GAAG,EAAE,IANS;AAOdC,MAAAA,GAAG,EAAE,IAPS;AAQdC,MAAAA,GAAG,EAAE,IARS;AASdC,MAAAA,GAAG,EAAE;AATS,KAfX;AA0BLC,IAAAA,eAAe,EAAE;AA1BZ,GAFY;AA8BnBC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,OAAO,EAAE;AACP,iBAAS,SADF;AAEPC,MAAAA,IAAI,EAAE;AAFC,KADD;AAKRC,IAAAA,SAAS,EAAE;AACT,iBAAS,WADA;AAETD,MAAAA,IAAI,EAAE;AAFG,KALH;AASRE,IAAAA,OAAO,EAAE;AACP,iBAAS,QADF;AAEPF,MAAAA,IAAI,EAAE;AAFC;AATD;AA9BS,CAAd;;AA8CA,IAAMG,aAAa,GAAG;AAC3BC,EAAAA,MAAM,EAAE;AACNC,IAAAA,QAAQ,EAAE,IADJ;AAENC,IAAAA,KAAK,EAAE;AAFD,GADmB;AAK3BC,EAAAA,UAAU,EAAE;AACVD,IAAAA,KAAK,EAAE,YADG;AAEVD,IAAAA,QAAQ,EAAE,KAFA;AAGVG,IAAAA,OAAO,EAAE;AAHC,GALe;AAU3BC,EAAAA,aAAa,EAAE;AACbC,IAAAA,SAAS,EAAE,KADE;AAEbC,IAAAA,UAAU,EAAE;AAFC,GAVY;AAc3BC,EAAAA,QAAQ,EAAE;AACRP,IAAAA,QAAQ,EAAE,KADF;AAERC,IAAAA,KAAK,EAAE,kBAFC;AAGRE,IAAAA,OAAO,EAAE;AAHD,GAdiB;AAmB3BK,EAAAA,eAAe,EAAE;AACfP,IAAAA,KAAK,EAAE,kBADQ;AAEfQ,IAAAA,OAAO,EAAE;AAFM;AAnBU,CAAtB","sourcesContent":["export const model = {\n correctResponse: [],\n graph: {\n domain: { min: -5, max: 5 },\n ticks: {\n minor: 1,\n major: 2,\n },\n arrows: {\n left: true,\n right: true,\n },\n maxNumberOfPoints: 20,\n width: 500,\n initialType: 'PF',\n exhibitOnly: false,\n toolbarEditorPosition: 'bottom',\n availableTypes: {\n PF: true,\n LFF: true,\n LEF: true,\n LFE: true,\n LEE: true,\n RFN: true,\n RFP: true,\n REN: true,\n REP: true,\n },\n initialElements: [],\n },\n feedback: {\n correct: {\n default: 'Correct',\n type: 'none',\n },\n incorrect: {\n default: 'Incorrect',\n type: 'none',\n },\n partial: {\n default: 'Nearly',\n type: 'none',\n },\n },\n};\n\nexport const configuration = {\n prompt: {\n settings: true,\n label: 'Prompt',\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n};\n"],"file":"defaults.js"}
|
package/configure/lib/index.js
CHANGED
|
@@ -140,8 +140,20 @@ var NumberLine = /*#__PURE__*/function (_HTMLElement) {
|
|
|
140
140
|
exports["default"] = NumberLine;
|
|
141
141
|
(0, _defineProperty2["default"])(NumberLine, "createDefaultModel", function () {
|
|
142
142
|
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
143
|
+
var c = defaults.configuration;
|
|
144
|
+
var language = '';
|
|
143
145
|
|
|
144
|
-
|
|
146
|
+
if (c.language && c.language.enabled) {
|
|
147
|
+
var _c$languageChoices, _c$languageChoices$op;
|
|
148
|
+
|
|
149
|
+
if ((_c$languageChoices = c.languageChoices) !== null && _c$languageChoices !== void 0 && (_c$languageChoices$op = _c$languageChoices.options) !== null && _c$languageChoices$op !== void 0 && _c$languageChoices$op.length) {
|
|
150
|
+
language = c.languageChoices.options[0].value;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
var normalizedModel = _objectSpread(_objectSpread(_objectSpread({}, defaults.model), model), {}, {
|
|
155
|
+
language: language
|
|
156
|
+
});
|
|
145
157
|
|
|
146
158
|
return updateTicks(normalizedModel);
|
|
147
159
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["updateTicks","model","graph","domain","labelStep","ticks","minor","major","min","Number","toFixed","max","match","fraction","step","math","evaluate","NumberLine","o","_model","dispatchEvent","ModelUpdatedEvent","_rerender","createDefaultModel","_configuration","defaults","configuration","s","handler","InsertSoundEvent","src","done","DeleteSoundEvent","element","React","createElement","Main","onChange","uploadSoundSupport","add","insertSound","bind","onDeleteSound","React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U;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["updateTicks","model","graph","domain","labelStep","ticks","minor","major","min","Number","toFixed","max","match","fraction","step","math","evaluate","NumberLine","o","_model","dispatchEvent","ModelUpdatedEvent","_rerender","createDefaultModel","_configuration","defaults","configuration","s","handler","InsertSoundEvent","src","done","DeleteSoundEvent","element","React","createElement","Main","onChange","uploadSoundSupport","add","insertSound","bind","onDeleteSound","ReactDOM","render","HTMLElement","c","language","enabled","languageChoices","options","length","value","normalizedModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA;AACA,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAACC,KAAD,EAAW;AAC7B,qBAA0DA,KAA1D,CAAQC,KAAR;AAAA,2CAAmD,EAAnD;AAAA,MAAiBC,MAAjB,gBAAiBA,MAAjB;AAAA,MAAyBC,SAAzB,gBAAyBA,SAAzB;AAAA,wCAAoCC,KAApC;AAAA,MAAoCA,KAApC,mCAA4C,EAA5C;AACA,MAAQC,KAAR,GAAyBD,KAAzB,CAAQC,KAAR;AAAA,MAAeC,KAAf,GAAyBF,KAAzB,CAAeE,KAAf;;AAEA,MAAIJ,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACK,GAAP,GAAaC,MAAM,CAAC,CAACN,MAAM,CAACK,GAAP,IAAc,CAAf,EAAkBE,OAAlB,CAA0B,CAA1B,CAAD,CAAnB;AACAP,IAAAA,MAAM,CAACQ,GAAP,GAAaF,MAAM,CAAC,CAACN,MAAM,CAACQ,GAAP,IAAc,CAAf,EAAkBD,OAAlB,CAA0B,CAA1B,CAAD,CAAnB;AACD;;AAED,MAAIN,SAAS,IAAI,OAAOA,SAAP,KAAqB,QAAlC,IAA8CA,SAAS,CAACQ,KAAV,CAAgB,6BAAhB,CAAlD,EAAkG;AAChGX,IAAAA,KAAK,CAACC,KAAN,CAAYW,QAAZ,GAAuB,IAAvB,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C,UAAAA,GAAG,EAAE,KAAKC,WAAL,CAAiBC,IAAjB,CAAsB,IAAtB,CADa;AAElB,oBAAQ,KAAKC,aAAL,CAAmBD,IAAnB,CAAwB,IAAxB;AAFU;AAJkB,OAA1B,CAAd;;AAUAE,2BAASC,MAAT,CAAgBX,OAAhB,EAAyB,IAAzB;AACD;;;kDA3DqCY,W;;;iCAAnB5B,U,wBACS,YAAgB;AAAA,MAAfhB,KAAe,uEAAP,EAAO;AAC1C,MAAM6C,CAAC,GAAGrB,QAAQ,CAACC,aAAnB;AACA,MAAIqB,QAAQ,GAAG,EAAf;;AAEA,MAAID,CAAC,CAACC,QAAF,IAAcD,CAAC,CAACC,QAAF,CAAWC,OAA7B,EAAsC;AAAA;;AACpC,8BAAIF,CAAC,CAACG,eAAN,wEAAI,mBAAmBC,OAAvB,kDAAI,sBAA4BC,MAAhC,EAAwC;AACtCJ,MAAAA,QAAQ,GAAGD,CAAC,CAACG,eAAF,CAAkBC,OAAlB,CAA0B,CAA1B,EAA6BE,KAAxC;AACD;AACF;;AAED,MAAMC,eAAe,iDAChB5B,QAAQ,CAACxB,KADO,GAEhBA,KAFgB;AAGnB8C,IAAAA,QAAQ,EAARA;AAHmB,IAArB;;AAMA,SAAO/C,WAAW,CAACqD,eAAD,CAAlB;AACD,C","sourcesContent":["import Main from './main';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { ModelUpdatedEvent, InsertSoundEvent, DeleteSoundEvent } from '@pie-framework/pie-configure-events';\nimport * as defaults from './defaults';\nimport * as math from 'mathjs';\n\n// this function is duplicated in controller; at some point, use the same shared function\nconst updateTicks = (model) => {\n const { graph: { domain, labelStep, ticks = {} } = {} } = model;\n const { minor, major } = ticks;\n\n if (domain) {\n domain.min = Number((domain.min || 0).toFixed(2));\n domain.max = Number((domain.max || 0).toFixed(2));\n }\n\n if (labelStep && typeof labelStep === 'string' && labelStep.match(/^[1-9][0-9]*\\/[1-9][0-9]*$/g)) {\n model.graph.fraction = true;\n\n // update the ticks frequency and label value to match the label step if needed\n const step = math.evaluate(labelStep);\n\n if (step !== major) {\n ticks.major = step;\n ticks.minor = step / (major / minor);\n }\n }\n\n return model;\n};\n\nexport default class NumberLine extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const c = defaults.configuration;\n let language = '';\n\n if (c.language && c.language.enabled) {\n if (c.languageChoices?.options?.length) {\n language = c.languageChoices.options[0].value;\n }\n }\n\n const normalizedModel = {\n ...defaults.model,\n ...model,\n language\n };\n\n return updateTicks(normalizedModel);\n };\n\n constructor() {\n super();\n this._model = NumberLine.createDefaultModel();\n this._configuration = defaults.configuration;\n }\n\n set model(s) {\n this._model = NumberLine.createDefaultModel(s);\n this._rerender();\n }\n\n onChange = (o) => {\n this._model = { ...this._model, ...o };\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model));\n\n this._rerender();\n };\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _rerender() {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onChange: this.onChange,\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|
package/configure/lib/main.js
CHANGED
|
@@ -432,7 +432,9 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
432
432
|
_ref4$contentDimensio = _ref4.contentDimensions,
|
|
433
433
|
contentDimensions = _ref4$contentDimensio === void 0 ? {} : _ref4$contentDimensio,
|
|
434
434
|
_ref4$prompt = _ref4.prompt,
|
|
435
|
-
prompt = _ref4$prompt === void 0 ? {} : _ref4$prompt
|
|
435
|
+
prompt = _ref4$prompt === void 0 ? {} : _ref4$prompt,
|
|
436
|
+
_ref4$mathMlOptions = _ref4.mathMlOptions,
|
|
437
|
+
mathMlOptions = _ref4$mathMlOptions === void 0 ? {} : _ref4$mathMlOptions;
|
|
436
438
|
|
|
437
439
|
var _ref5 = model || {},
|
|
438
440
|
errors = _ref5.errors,
|
|
@@ -477,7 +479,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
477
479
|
language: 'spanish'
|
|
478
480
|
}, {
|
|
479
481
|
language: 'special'
|
|
480
|
-
}]
|
|
482
|
+
}],
|
|
483
|
+
mathMlOptions: mathMlOptions
|
|
481
484
|
})), /*#__PURE__*/_react["default"].createElement(_cardBar["default"], {
|
|
482
485
|
header: "Attributes",
|
|
483
486
|
info: /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
@@ -543,7 +546,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
543
546
|
language: 'spanish'
|
|
544
547
|
}, {
|
|
545
548
|
language: 'special'
|
|
546
|
-
}]
|
|
549
|
+
}],
|
|
550
|
+
mathMlOptions: mathMlOptions
|
|
547
551
|
})), /*#__PURE__*/_react["default"].createElement(_configUi.FormSection, {
|
|
548
552
|
label: 'Limits'
|
|
549
553
|
}, /*#__PURE__*/_react["default"].createElement(_numberTextField["default"], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["trimModel","model","feedback","undefined","prompt","graph","title","correctResponse","lineIsSwitched","dataConverter","switchGraphLine","toGraphFormat","toSessionFormat","styles","theme","maxNumberOfPoints","width","checkbox","marginTop","spacing","unit","marginBottom","row","display","flexWrap","paddingRight","pointTypeChooser","margin","promptContainer","paddingTop","tooltip","fontSize","typography","whiteSpace","maxWidth","inlineFlexContainer","resetButton","errorText","color","palette","error","main","toPointType","response","rest","pointType","direction","leftPoint","rightPoint","type","toUpperCase","Main","props","obj","onChange","height","graphChange","availableTypes","onlyPFAvailable","Object","entries","forEach","value","e","getAdjustedHeight","ticks","tickUtils","snapElements","domain","initialElements","arrows","defaultModel","event","exhibitOnly","index","el","position","update","Set","map","indices","filter","v","some","d","data","push","pop","classes","configuration","uploadSoundSupport","contentDimensions","errors","spellCheckEnabled","toolbarEditorPosition","widthError","domainError","maxError","pointsError","correctResponseError","validationMessage","initialView","toolbarOpts","settings","label","language","marginLeft","changeSize","changeTicks","changeArrows","changeGraphTitle","changeMaxNoOfPoints","setDefaults","availableTypesChange","moveCorrectResponse","deleteCorrectResponse","addCorrectResponse","clearCorrectResponse","undoCorrectResponse","moveInitialView","deleteInitialView","addInitialView","clearInitialView","undoInitialView","exhibitChanged","React","Component","PropTypes","object","isRequired","func","name"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;AAAA,yCACbA,KADa;AAEhBC,IAAAA,QAAQ,EAAEC,SAFM;AAGhBC,IAAAA,MAAM,EAAED,SAHQ;AAIhBE,IAAAA,KAAK,kCAAOJ,KAAK,CAACI,KAAb;AAAoBC,MAAAA,KAAK,EAAEH;AAA3B,MAJW;AAKhBI,IAAAA,eAAe,EAAEJ;AALD;AAAA,CAAlB;;AAQA,IAAQK,cAAR,GAA4EC,yBAA5E,CAAQD,cAAR;AAAA,IAAwBE,eAAxB,GAA4ED,yBAA5E,CAAwBC,eAAxB;AAAA,IAAyCC,aAAzC,GAA4EF,yBAA5E,CAAyCE,aAAzC;AAAA,IAAwDC,eAAxD,GAA4EH,yBAA5E,CAAwDG,eAAxD;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,iBAAiB,EAAE;AACjBC,MAAAA,KAAK,EAAE;AADU,KADM;AAIzBC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,SAAS,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CADxB;AAERC,MAAAA,YAAY,EAAEP,KAAK,CAACK,OAAN,CA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AAGE,QAAA,OAAO,EAAEZ,KAAK,CAACoE,WAHjB;AAIE,QAAA,QAAQ,EAAE,KAAKmD,cAJjB;AAKE,QAAA,KAAK,EAAE;AALT,QAhIF,EAwIG,CAACvH,KAAK,CAACoE,WAAP,iBACC,gCAAC,wBAAD;AACE,QAAA,QAAQ,EAAExE,KAAK,CAACC,QADlB;AAEE,QAAA,QAAQ,EAAE,kBAACA,QAAD;AAAA,iBAAcoD,SAAQ,CAAC;AAAEpD,YAAAA,QAAQ,EAARA;AAAF,WAAD,CAAtB;AAAA,SAFZ;AAGE,QAAA,WAAW,EAAEoG;AAHf,QAzIJ,CADF;AAkJD;;;EA7VuBuB,kBAAMC,S;;;iCAAnB3E,I,eACQ;AACjBqC,EAAAA,OAAO,EAAEuC,sBAAUC,MAAV,CAAiBC,UADT;AAEjBhI,EAAAA,KAAK,EAAE8H,sBAAUC,MAAV,CAAiBC,UAFP;AAGjBxC,EAAAA,aAAa,EAAEsC,sBAAUC,MAAV,CAAiBC,UAHf;AAIjB3E,EAAAA,QAAQ,EAAEyE,sBAAUG,IAAV,CAAeD,UAJR;AAKjBvC,EAAAA,kBAAkB,EAAEqC,sBAAUC,MAAV,CAAiBC;AALpB,C;;eA+VN,wBAAWpH,MAAX,EAAmB;AAAEsH,EAAAA,IAAI,EAAE;AAAR,CAAnB,EAAqChF,IAArC,C","sourcesContent":["import React from 'react';\nimport { InputCheckbox, FeedbackConfig, FormSection, InputContainer, layout } from '@pie-lib/config-ui';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { NumberLineComponent, dataConverter, tickUtils } from '@pie-element/number-line';\nimport NumberTextField from './number-text-field';\nimport CardBar from './card-bar';\nimport Size from './size';\nimport PropTypes from 'prop-types';\nimport Domain from './domain';\nimport Arrows from './arrows';\nimport PointConfig from './point-config';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nimport Ticks from './ticks';\nimport { model as defaultModel } from './defaults';\nimport { generateValidationMessage } from './utils';\n\nconst trimModel = (model) => ({\n ...model,\n feedback: undefined,\n prompt: undefined,\n graph: { ...model.graph, title: undefined },\n correctResponse: undefined,\n});\n\nconst { lineIsSwitched, switchGraphLine, toGraphFormat, toSessionFormat } = dataConverter;\n\nconst styles = (theme) => ({\n maxNumberOfPoints: {\n width: '150px',\n },\n checkbox: {\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n row: {\n display: 'flex',\n flexWrap: 'wrap',\n '& > *': {\n paddingRight: theme.spacing.unit * 2,\n },\n },\n pointTypeChooser: {\n margin: `${theme.spacing.unit * 2.5}px 0`,\n },\n promptContainer: {\n paddingTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n width: '100%',\n },\n title: {\n marginBottom: theme.spacing.unit * 4,\n },\n tooltip: {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n inlineFlexContainer: {\n display: 'inline-flex',\n },\n resetButton: {\n marginBottom: theme.spacing.unit * 2.5,\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit,\n },\n});\n\nexport const toPointType = (response) => {\n function rest(response) {\n if (response.pointType) {\n if (response.direction) {\n return `${response.pointType[0]}${response.direction[0]}`;\n }\n\n return response.pointType[0];\n }\n\n return `${response.leftPoint[0]}${response.rightPoint[0]}`;\n }\n\n return `${response.type[0]}${rest(response)}`.toUpperCase();\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n uploadSoundSupport: PropTypes.object.isRequired,\n };\n\n constructor(props) {\n super(props);\n const {\n model: {\n graph: { availableTypes, maxNumberOfPoints },\n },\n } = props;\n const height = this.getAdjustedHeight(availableTypes, maxNumberOfPoints);\n\n this.graphChange({ height });\n }\n\n graphChange = (obj) => {\n const { model, onChange } = this.props;\n const graph = { ...model.graph, ...obj };\n\n onChange({ graph });\n };\n\n changeSize = ({ width, height }) => this.graphChange({ width, height });\n\n getAdjustedHeight = (availableTypes, maxNumberOfPoints) => {\n let onlyPFAvailable = true;\n\n Object.entries(availableTypes || {}).forEach(([type, value]) => {\n if (type !== 'PF' && value) {\n onlyPFAvailable = false;\n\n return;\n }\n });\n\n return maxNumberOfPoints && (maxNumberOfPoints === 1 || onlyPFAvailable)\n ? 100\n : 50 + (maxNumberOfPoints || 20) * 25;\n };\n\n changeMaxNoOfPoints = (e, maxNumberOfPoints) => {\n const {\n model: {\n graph: { availableTypes },\n },\n } = this.props;\n const height = this.getAdjustedHeight(availableTypes, maxNumberOfPoints);\n\n this.graphChange({ maxNumberOfPoints, height });\n };\n\n changeGraphTitle = (title) => this.graphChange({ title });\n\n changeTicks = (ticks) => {\n const { model, onChange } = this.props;\n const correctResponse = tickUtils.snapElements(model.graph.domain, ticks, model.correctResponse);\n const initialElements = tickUtils.snapElements(model.graph.domain, ticks, model.graph.initialElements);\n const graph = { ...model.graph, ticks, initialElements };\n\n onChange({ graph, correctResponse });\n };\n\n changeArrows = (arrows) => this.graphChange({ arrows });\n\n setDefaults = () => {\n const {\n graph: { availableTypes, maxNumberOfPoints },\n } = defaultModel;\n const height = this.getAdjustedHeight(availableTypes, maxNumberOfPoints);\n const graph = { ...cloneDeep(defaultModel.graph), height };\n\n this.props.onChange({ graph });\n };\n\n exhibitChanged = (event, value) => {\n const graph = { ...this.props.model.graph, exhibitOnly: value };\n\n this.props.onChange({ graph });\n };\n\n moveCorrectResponse = (index, el, position) => {\n el.position = position;\n\n const { onChange, model } = this.props;\n const update = toSessionFormat(el.type === 'line' && lineIsSwitched(el) ? switchGraphLine(el) : el);\n const correctResponse = [...model.correctResponse];\n correctResponse[index] = update;\n\n onChange({ correctResponse });\n };\n\n moveInitialView = (index, el, position) => {\n el.position = position;\n\n const { model, onChange } = this.props;\n const update = toSessionFormat(el.type === 'line' && lineIsSwitched(el) ? switchGraphLine(el) : el);\n const initialElements = [...model.graph.initialElements];\n initialElements[index] = update;\n const graph = { ...model.graph, initialElements };\n\n onChange({ graph });\n };\n\n availableTypesChange = (availableTypes) => {\n const { model, onChange } = this.props;\n const {\n correctResponse,\n graph: { maxNumberOfPoints },\n } = model;\n\n new Set(correctResponse.map(toPointType)).forEach((pointType) => {\n availableTypes[pointType] = true;\n });\n\n const height = this.getAdjustedHeight(availableTypes, maxNumberOfPoints);\n const graph = { ...model.graph, availableTypes, height };\n\n onChange({ graph });\n };\n\n deleteCorrectResponse = (indices) => {\n const { model, onChange } = this.props;\n const correctResponse = model.correctResponse.filter((v, index) => !indices.some((d) => d === index));\n\n onChange({ correctResponse });\n };\n\n deleteInitialView = (indices) => {\n const { model, onChange } = this.props;\n const initialElements = model.graph.initialElements.filter((v, index) => !indices.some((d) => d === index));\n const graph = { ...model.graph, initialElements };\n\n onChange({ graph });\n };\n\n addCorrectResponse = (data) => {\n const { model, onChange } = this.props;\n const correctResponse = [...model.correctResponse];\n correctResponse.push(toSessionFormat(data));\n\n onChange({ correctResponse });\n };\n\n addInitialView = (data) => {\n const { onChange, model } = this.props;\n const graph = { ...model.graph };\n graph.initialElements = graph.initialElements || [];\n graph.initialElements.push(toSessionFormat(data));\n\n onChange({ graph });\n };\n\n clearCorrectResponse = () => {\n const { onChange } = this.props;\n\n onChange({ correctResponse: [] });\n };\n\n clearInitialView = () => {\n const { model, onChange } = this.props;\n const graph = { ...model.graph, initialElements: [] };\n\n onChange({ graph });\n };\n\n undoCorrectResponse = () => {\n const { model, onChange } = this.props;\n const correctResponse = [...model.correctResponse];\n correctResponse.pop();\n\n onChange({ correctResponse });\n };\n\n undoInitialView = () => {\n const { onChange, model } = this.props;\n const graph = { ...model.graph };\n graph.initialElements = graph.initialElements || [];\n graph.initialElements.pop();\n\n onChange({ graph });\n };\n\n render() {\n const { classes, model, onChange, configuration, uploadSoundSupport } = this.props;\n const { contentDimensions = {}, prompt = {} } = configuration || {};\n const { errors, graph, spellCheckEnabled, toolbarEditorPosition } = model || {};\n\n const { widthError, domainError, maxError, pointsError, correctResponseError } = errors || {};\n const validationMessage = generateValidationMessage();\n\n const correctResponse = cloneDeep(model.correctResponse || []).map(toGraphFormat);\n const initialView = cloneDeep(graph.initialElements || []).map(toGraphFormat);\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n return (\n <layout.ConfigLayout dimensions={contentDimensions} hideSettings={true} settings={null}>\n {prompt.settings && (\n <InputContainer label={prompt.label} className={classes.promptContainer}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={(prompt) => onChange({ prompt })}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n <CardBar\n header=\"Attributes\"\n info={\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '8px' }} />\n </Tooltip>\n }\n >\n Set up the number line by entering the domain and number of tick marks to display. Labels on the number line\n can be edited or removed by clicking on the label.\n </CardBar>\n\n <div className={classes.row}>\n <FormSection label={'Size'}>\n <Size size={graph} onChange={this.changeSize} />\n </FormSection>\n\n <FormSection label={'Domain'}>\n <Domain domain={graph.domain} onChange={(domain) => this.graphChange({ domain })} />\n </FormSection>\n </div>\n\n {widthError && <div className={classes.errorText}>{widthError}</div>}\n {maxError && <div className={classes.errorText}>{maxError}</div>}\n {domainError && <div className={classes.errorText}>{domainError}</div>}\n\n <div className={classes.row}>\n <FormSection label={'Ticks'}>\n <Ticks ticks={graph.ticks} onChange={this.changeTicks} domain={graph.domain} />\n </FormSection>\n\n <FormSection label={'Arrows'}>\n <Arrows arrows={graph.arrows} onChange={this.changeArrows} />\n </FormSection>\n </div>\n\n <FormSection label={'Title'} className={classes.title}>\n <EditableHtml\n markup={graph.title || ''}\n onChange={this.changeGraphTitle}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </FormSection>\n\n <FormSection label={'Limits'}>\n <NumberTextField\n className={classes.maxNumberOfPoints}\n label=\"Max No of Elements\"\n min={1}\n max={20}\n value={graph.maxNumberOfPoints}\n onChange={this.changeMaxNoOfPoints}\n />\n {pointsError && <div className={classes.errorText}>{pointsError}</div>}\n </FormSection>\n\n <Button className={classes.resetButton} variant=\"outlined\" mini color=\"primary\" onClick={this.setDefaults}>\n Reset to default values\n </Button>\n\n {!graph.exhibitOnly && (\n <React.Fragment>\n <CardBar header=\"Available Types\" mini>\n Click on the input options to be displayed to the students. All inputs will display by default.\n </CardBar>\n\n <div className={classes.pointTypeChooser}>\n <PointConfig onSelectionChange={this.availableTypesChange} selection={graph.availableTypes} />\n </div>\n\n <CardBar header=\"Correct Response\">\n Select answer type and place it on the number line. Intersecting points, line segments and/or rays will\n appear above the number line. <i>Note: A maximum of 20 points, line segments or rays may be plotted.</i>\n </CardBar>\n <NumberLineComponent\n onMoveElement={this.moveCorrectResponse}\n onDeleteElements={this.deleteCorrectResponse}\n onAddElement={this.addCorrectResponse}\n onClearElements={this.clearCorrectResponse}\n onUndoElement={this.undoCorrectResponse}\n answer={correctResponse}\n //strip feedback for this model\n model={trimModel(model)}\n />\n {correctResponseError && <div className={classes.errorText}>{correctResponseError}</div>}\n </React.Fragment>\n )}\n\n <CardBar header=\"Initial view/Make Exhibit\">\n Use this number line to set a starting point, line segment or ray. This is optional. <br />\n This number line may also be used to make an exhibit number line, which can not be manipulated by a student.\n </CardBar>\n <NumberLineComponent\n onMoveElement={this.moveInitialView}\n onDeleteElements={this.deleteInitialView}\n onAddElement={this.addInitialView}\n onClearElements={this.clearInitialView}\n onUndoElement={this.undoInitialView}\n answer={initialView}\n model={trimModel(model)}\n />\n\n <InputCheckbox\n label=\"Make exhibit\"\n className={classes.checkbox}\n checked={graph.exhibitOnly}\n onChange={this.exhibitChanged}\n value={'exhibitOnly'}\n />\n\n {!graph.exhibitOnly && (\n <FeedbackConfig\n feedback={model.feedback}\n onChange={(feedback) => onChange({ feedback })}\n toolbarOpts={toolbarOpts}\n />\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles, { name: 'Main' })(Main);\n"],"file":"main.js"}
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["trimModel","model","feedback","undefined","prompt","graph","title","correctResponse","lineIsSwitched","dataConverter","switchGraphLine","toGraphFormat","toSessionFormat","styles","theme","maxNumberOfPoints","width","checkbox","marginTop","spacing","unit","marginBottom","row","display","flexWrap","paddingRight","pointTypeChooser","margin","promptContainer","paddingTop","tooltip","fontSize","typography","whiteSpace","maxWidth","inlineFlexContainer","resetButton","errorText","color","palette","error","main","toPointType","response","rest","pointType","direction","leftPoint","rightPoint","type","toUpperCase","Main","props","obj","onChange","height","graphChange","availableTypes","onlyPFAvailable","Object","entries","forEach","value","e","getAdjustedHeight","ticks","tickUtils","snapElements","domain","initialElements","arrows","defaultModel","event","exhibitOnly","index","el","position","update","Set","map","indices","filter","v","some","d","data","push","pop","classes","configuration","uploadSoundSupport","contentDimensions","mathMlOptions","errors","spellCheckEnabled","toolbarEditorPosition","widthError","domainError","maxError","pointsError","correctResponseError","validationMessage","initialView","toolbarOpts","settings","label","language","marginLeft","changeSize","changeTicks","changeArrows","changeGraphTitle","changeMaxNoOfPoints","setDefaults","availableTypesChange","moveCorrectResponse","deleteCorrectResponse","addCorrectResponse","clearCorrectResponse","undoCorrectResponse","moveInitialView","deleteInitialView","addInitialView","clearInitialView","undoInitialView","exhibitChanged","React","Component","PropTypes","object","isRequired","func","name"],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,wBAAD;AACE,QAAA,QAAQ,EAAExE,KAAK,CAACC,QADlB;AAEE,QAAA,QAAQ,EAAE,kBAACA,QAAD;AAAA,iBAAcoD,SAAQ,CAAC;AAAEpD,YAAAA,QAAQ,EAARA;AAAF,WAAD,CAAtB;AAAA,SAFZ;AAGE,QAAA,WAAW,EAAEqG;AAHf,QA3IJ,CADF;AAoJD;;;EA/VuBuB,kBAAMC,S;;;iCAAnB5E,I,eACQ;AACjBqC,EAAAA,OAAO,EAAEwC,sBAAUC,MAAV,CAAiBC,UADT;AAEjBjI,EAAAA,KAAK,EAAE+H,sBAAUC,MAAV,CAAiBC,UAFP;AAGjBzC,EAAAA,aAAa,EAAEuC,sBAAUC,MAAV,CAAiBC,UAHf;AAIjB5E,EAAAA,QAAQ,EAAE0E,sBAAUG,IAAV,CAAeD,UAJR;AAKjBxC,EAAAA,kBAAkB,EAAEsC,sBAAUC,MAAV,CAAiBC;AALpB,C;;eAiWN,wBAAWrH,MAAX,EAAmB;AAAEuH,EAAAA,IAAI,EAAE;AAAR,CAAnB,EAAqCjF,IAArC,C","sourcesContent":["import React from 'react';\nimport { InputCheckbox, FeedbackConfig, FormSection, InputContainer, layout } from '@pie-lib/config-ui';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { NumberLineComponent, dataConverter, tickUtils } from '@pie-element/number-line';\nimport NumberTextField from './number-text-field';\nimport CardBar from './card-bar';\nimport Size from './size';\nimport PropTypes from 'prop-types';\nimport Domain from './domain';\nimport Arrows from './arrows';\nimport PointConfig from './point-config';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nimport Ticks from './ticks';\nimport { model as defaultModel } from './defaults';\nimport { generateValidationMessage } from './utils';\n\nconst trimModel = (model) => ({\n ...model,\n feedback: undefined,\n prompt: undefined,\n graph: { ...model.graph, title: undefined },\n correctResponse: undefined,\n});\n\nconst { lineIsSwitched, switchGraphLine, toGraphFormat, toSessionFormat } = dataConverter;\n\nconst styles = (theme) => ({\n maxNumberOfPoints: {\n width: '150px',\n },\n checkbox: {\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n row: {\n display: 'flex',\n flexWrap: 'wrap',\n '& > *': {\n paddingRight: theme.spacing.unit * 2,\n },\n },\n pointTypeChooser: {\n margin: `${theme.spacing.unit * 2.5}px 0`,\n },\n promptContainer: {\n paddingTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n width: '100%',\n },\n title: {\n marginBottom: theme.spacing.unit * 4,\n },\n tooltip: {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n inlineFlexContainer: {\n display: 'inline-flex',\n },\n resetButton: {\n marginBottom: theme.spacing.unit * 2.5,\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit,\n },\n});\n\nexport const toPointType = (response) => {\n function rest(response) {\n if (response.pointType) {\n if (response.direction) {\n return `${response.pointType[0]}${response.direction[0]}`;\n }\n\n return response.pointType[0];\n }\n\n return `${response.leftPoint[0]}${response.rightPoint[0]}`;\n }\n\n return `${response.type[0]}${rest(response)}`.toUpperCase();\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n uploadSoundSupport: PropTypes.object.isRequired,\n };\n\n constructor(props) {\n super(props);\n const {\n model: {\n graph: { availableTypes, maxNumberOfPoints },\n },\n } = props;\n const height = this.getAdjustedHeight(availableTypes, maxNumberOfPoints);\n\n this.graphChange({ height });\n }\n\n graphChange = (obj) => {\n const { model, onChange } = this.props;\n const graph = { ...model.graph, ...obj };\n\n onChange({ graph });\n };\n\n changeSize = ({ width, height }) => this.graphChange({ width, height });\n\n getAdjustedHeight = (availableTypes, maxNumberOfPoints) => {\n let onlyPFAvailable = true;\n\n Object.entries(availableTypes || {}).forEach(([type, value]) => {\n if (type !== 'PF' && value) {\n onlyPFAvailable = false;\n\n return;\n }\n });\n\n return maxNumberOfPoints && (maxNumberOfPoints === 1 || onlyPFAvailable)\n ? 100\n : 50 + (maxNumberOfPoints || 20) * 25;\n };\n\n changeMaxNoOfPoints = (e, maxNumberOfPoints) => {\n const {\n model: {\n graph: { availableTypes },\n },\n } = this.props;\n const height = this.getAdjustedHeight(availableTypes, maxNumberOfPoints);\n\n this.graphChange({ maxNumberOfPoints, height });\n };\n\n changeGraphTitle = (title) => this.graphChange({ title });\n\n changeTicks = (ticks) => {\n const { model, onChange } = this.props;\n const correctResponse = tickUtils.snapElements(model.graph.domain, ticks, model.correctResponse);\n const initialElements = tickUtils.snapElements(model.graph.domain, ticks, model.graph.initialElements);\n const graph = { ...model.graph, ticks, initialElements };\n\n onChange({ graph, correctResponse });\n };\n\n changeArrows = (arrows) => this.graphChange({ arrows });\n\n setDefaults = () => {\n const {\n graph: { availableTypes, maxNumberOfPoints },\n } = defaultModel;\n const height = this.getAdjustedHeight(availableTypes, maxNumberOfPoints);\n const graph = { ...cloneDeep(defaultModel.graph), height };\n\n this.props.onChange({ graph });\n };\n\n exhibitChanged = (event, value) => {\n const graph = { ...this.props.model.graph, exhibitOnly: value };\n\n this.props.onChange({ graph });\n };\n\n moveCorrectResponse = (index, el, position) => {\n el.position = position;\n\n const { onChange, model } = this.props;\n const update = toSessionFormat(el.type === 'line' && lineIsSwitched(el) ? switchGraphLine(el) : el);\n const correctResponse = [...model.correctResponse];\n correctResponse[index] = update;\n\n onChange({ correctResponse });\n };\n\n moveInitialView = (index, el, position) => {\n el.position = position;\n\n const { model, onChange } = this.props;\n const update = toSessionFormat(el.type === 'line' && lineIsSwitched(el) ? switchGraphLine(el) : el);\n const initialElements = [...model.graph.initialElements];\n initialElements[index] = update;\n const graph = { ...model.graph, initialElements };\n\n onChange({ graph });\n };\n\n availableTypesChange = (availableTypes) => {\n const { model, onChange } = this.props;\n const {\n correctResponse,\n graph: { maxNumberOfPoints },\n } = model;\n\n new Set(correctResponse.map(toPointType)).forEach((pointType) => {\n availableTypes[pointType] = true;\n });\n\n const height = this.getAdjustedHeight(availableTypes, maxNumberOfPoints);\n const graph = { ...model.graph, availableTypes, height };\n\n onChange({ graph });\n };\n\n deleteCorrectResponse = (indices) => {\n const { model, onChange } = this.props;\n const correctResponse = model.correctResponse.filter((v, index) => !indices.some((d) => d === index));\n\n onChange({ correctResponse });\n };\n\n deleteInitialView = (indices) => {\n const { model, onChange } = this.props;\n const initialElements = model.graph.initialElements.filter((v, index) => !indices.some((d) => d === index));\n const graph = { ...model.graph, initialElements };\n\n onChange({ graph });\n };\n\n addCorrectResponse = (data) => {\n const { model, onChange } = this.props;\n const correctResponse = [...model.correctResponse];\n correctResponse.push(toSessionFormat(data));\n\n onChange({ correctResponse });\n };\n\n addInitialView = (data) => {\n const { onChange, model } = this.props;\n const graph = { ...model.graph };\n graph.initialElements = graph.initialElements || [];\n graph.initialElements.push(toSessionFormat(data));\n\n onChange({ graph });\n };\n\n clearCorrectResponse = () => {\n const { onChange } = this.props;\n\n onChange({ correctResponse: [] });\n };\n\n clearInitialView = () => {\n const { model, onChange } = this.props;\n const graph = { ...model.graph, initialElements: [] };\n\n onChange({ graph });\n };\n\n undoCorrectResponse = () => {\n const { model, onChange } = this.props;\n const correctResponse = [...model.correctResponse];\n correctResponse.pop();\n\n onChange({ correctResponse });\n };\n\n undoInitialView = () => {\n const { onChange, model } = this.props;\n const graph = { ...model.graph };\n graph.initialElements = graph.initialElements || [];\n graph.initialElements.pop();\n\n onChange({ graph });\n };\n\n render() {\n const { classes, model, onChange, configuration, uploadSoundSupport } = this.props;\n const { contentDimensions = {}, prompt = {}, mathMlOptions = {} } = configuration || {};\n const { errors, graph, spellCheckEnabled, toolbarEditorPosition } = model || {};\n\n const { widthError, domainError, maxError, pointsError, correctResponseError } = errors || {};\n const validationMessage = generateValidationMessage();\n\n const correctResponse = cloneDeep(model.correctResponse || []).map(toGraphFormat);\n const initialView = cloneDeep(graph.initialElements || []).map(toGraphFormat);\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n return (\n <layout.ConfigLayout dimensions={contentDimensions} hideSettings={true} settings={null}>\n {prompt.settings && (\n <InputContainer label={prompt.label} className={classes.promptContainer}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={(prompt) => onChange({ prompt })}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n </InputContainer>\n )}\n\n <CardBar\n header=\"Attributes\"\n info={\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '8px' }} />\n </Tooltip>\n }\n >\n Set up the number line by entering the domain and number of tick marks to display. Labels on the number line\n can be edited or removed by clicking on the label.\n </CardBar>\n\n <div className={classes.row}>\n <FormSection label={'Size'}>\n <Size size={graph} onChange={this.changeSize} />\n </FormSection>\n\n <FormSection label={'Domain'}>\n <Domain domain={graph.domain} onChange={(domain) => this.graphChange({ domain })} />\n </FormSection>\n </div>\n\n {widthError && <div className={classes.errorText}>{widthError}</div>}\n {maxError && <div className={classes.errorText}>{maxError}</div>}\n {domainError && <div className={classes.errorText}>{domainError}</div>}\n\n <div className={classes.row}>\n <FormSection label={'Ticks'}>\n <Ticks ticks={graph.ticks} onChange={this.changeTicks} domain={graph.domain} />\n </FormSection>\n\n <FormSection label={'Arrows'}>\n <Arrows arrows={graph.arrows} onChange={this.changeArrows} />\n </FormSection>\n </div>\n\n <FormSection label={'Title'} className={classes.title}>\n <EditableHtml\n markup={graph.title || ''}\n onChange={this.changeGraphTitle}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n </FormSection>\n\n <FormSection label={'Limits'}>\n <NumberTextField\n className={classes.maxNumberOfPoints}\n label=\"Max No of Elements\"\n min={1}\n max={20}\n value={graph.maxNumberOfPoints}\n onChange={this.changeMaxNoOfPoints}\n />\n {pointsError && <div className={classes.errorText}>{pointsError}</div>}\n </FormSection>\n\n <Button className={classes.resetButton} variant=\"outlined\" mini color=\"primary\" onClick={this.setDefaults}>\n Reset to default values\n </Button>\n\n {!graph.exhibitOnly && (\n <React.Fragment>\n <CardBar header=\"Available Types\" mini>\n Click on the input options to be displayed to the students. All inputs will display by default.\n </CardBar>\n\n <div className={classes.pointTypeChooser}>\n <PointConfig onSelectionChange={this.availableTypesChange} selection={graph.availableTypes} />\n </div>\n\n <CardBar header=\"Correct Response\">\n Select answer type and place it on the number line. Intersecting points, line segments and/or rays will\n appear above the number line. <i>Note: A maximum of 20 points, line segments or rays may be plotted.</i>\n </CardBar>\n <NumberLineComponent\n onMoveElement={this.moveCorrectResponse}\n onDeleteElements={this.deleteCorrectResponse}\n onAddElement={this.addCorrectResponse}\n onClearElements={this.clearCorrectResponse}\n onUndoElement={this.undoCorrectResponse}\n answer={correctResponse}\n //strip feedback for this model\n model={trimModel(model)}\n />\n {correctResponseError && <div className={classes.errorText}>{correctResponseError}</div>}\n </React.Fragment>\n )}\n\n <CardBar header=\"Initial view/Make Exhibit\">\n Use this number line to set a starting point, line segment or ray. This is optional. <br />\n This number line may also be used to make an exhibit number line, which can not be manipulated by a student.\n </CardBar>\n <NumberLineComponent\n onMoveElement={this.moveInitialView}\n onDeleteElements={this.deleteInitialView}\n onAddElement={this.addInitialView}\n onClearElements={this.clearInitialView}\n onUndoElement={this.undoInitialView}\n answer={initialView}\n model={trimModel(model)}\n />\n\n <InputCheckbox\n label=\"Make exhibit\"\n className={classes.checkbox}\n checked={graph.exhibitOnly}\n onChange={this.exhibitChanged}\n value={'exhibitOnly'}\n />\n\n {!graph.exhibitOnly && (\n <FeedbackConfig\n feedback={model.feedback}\n onChange={(feedback) => onChange({ feedback })}\n toolbarOpts={toolbarOpts}\n />\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles, { name: 'Main' })(Main);\n"],"file":"main.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/number-line-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.10.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@material-ui/core": "^3.9.2",
|
|
9
9
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
10
|
-
"@pie-lib/config-ui": "^11.
|
|
11
|
-
"@pie-lib/editable-html": "^9.6.
|
|
10
|
+
"@pie-lib/config-ui": "^11.8.1",
|
|
11
|
+
"@pie-lib/editable-html": "^9.6.5",
|
|
12
12
|
"react": "^16.8.1",
|
|
13
13
|
"react-dom": "^16.8.1"
|
|
14
14
|
}
|
package/controller/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
|
+
# [4.6.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/number-line-controller@4.5.2...@pie-element/number-line-controller@4.6.0) (2023-06-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **number-line:** add translator PD-2795 ([23e78a9](https://github.com/pie-framework/pie-elements/commit/23e78a970805c88d7bad097bebaf170fe69003cc))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [4.5.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/number-line-controller@4.5.1...@pie-element/number-line-controller@4.5.2) (2023-04-25)
|
|
7
18
|
|
|
8
19
|
|
package/controller/lib/index.js
CHANGED
|
@@ -356,7 +356,8 @@ function model(question, session, env) {
|
|
|
356
356
|
type: correctness,
|
|
357
357
|
message: feedbackMessage
|
|
358
358
|
},
|
|
359
|
-
colorContrast: env.accessibility && env.accessibility.colorContrast || 'black_on_white'
|
|
359
|
+
colorContrast: env.accessibility && env.accessibility.colorContrast || 'black_on_white',
|
|
360
|
+
language: normalizedQuestion.language
|
|
360
361
|
};
|
|
361
362
|
resolve((0, _omitBy["default"])(out, function (v) {
|
|
362
363
|
return !v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["score","number","scaled","getPartialScore","corrected","ps","correct","rule","find","r","numberOfCorrect","length","scorePercentage","accumulateAnswer","correctResponse","total","answer","isCorrectResponse","some","cr","matches","outcome","model","session","env","Promise","resolve","empty","partialScoringEnabled","partialScoring","enabled","numCorrect","reduce","numIncorrect","getScore","question","getCorrected","correctness","getCorrectness","allowPartialScoring","filter","o","canDoPartialScoring","CLOSE_TO_PRECISION","closeTo","a","b","precision","expectedDiff","Math","pow","receivedDiff","abs","close","v","ov","incorrect","notInAnswer","noCorrectResponse","acc","index","match","push","splice","indexOf","normalize","feedback","defaults","createDefaultModel","out","graph","colorContrast","updateTicks","domain","labelStep","ticks","minor","major","min","Number","toFixed","max","fraction","step","math","evaluate","reject","Error","normalizedQuestion","evaluateMode","mode","exhibitOnly","disabled","fb","undefined","then","feedbackMessage","prompt","type","message","accessibility","createCorrectResponseSession","role","id","validate","width","maxNumberOfPoints","errors","widthError","domainError","maxError","pointsError","correctResponseError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA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;AAAA,MAAQmC,KAAR,SAAQA,KAAR;AAAA,MAAehC,MAAf,SAAeA,MAAf;AAAA,MAAuBiC,iBAAvB,SAAuBA,iBAAvB;;AACA,cAAqBjC,MAAM,IAAI,EAA/B;AAAA,MAAQK,GAAR,SAAQA,GAAR;AAAA,MAAaG,GAAb,SAAaA,GAAb;;AACA,MAAM0B,MAAM,GAAG,EAAf;;AAEA,MAAIF,KAAK,GAAG,GAAR,IAAeA,KAAK,GAAG,GAA3B,EAAgC;AAC9BE,IAAAA,MAAM,CAACC,UAAP,GAAoB,8CAApB;AACD;;AAED,MAAI9B,GAAG,GAAG,CAAC,MAAP,IAAiBA,GAAG,GAAG,KAAvB,IAAgCG,GAAG,GAAG,CAAC,MAAvC,IAAiDA,GAAG,GAAG,KAA3D,EAAkE;AAChE0B,IAAAA,MAAM,CAACE,WAAP,GAAqB,yDAArB;AACD;;AAED,MAAI/B,GAAG,IAAIG,GAAX,EAAgB;AACd0B,IAAAA,MAAM,CAACG,QAAP,GAAkB,+BAAlB;AACD;;AAED,MAAIJ,iBAAiB,GAAG,CAApB,IAAyBA,iBAAiB,GAAG,EAAjD,EAAqD;AACnDC,IAAAA,MAAM,CAACI,WAAP,GAAqB,oDAArB;AACD;;AAED,MAAIjG,eAAe,IAAIA,eAAe,CAACH,MAAhB,KAA2B,CAAlD,EAAqD;AACnDgG,IAAAA,MAAM,CAACK,oBAAP,GAA8B,oEAA9B;AACD;;AAED,SAAOL,MAAP;AACD,CA5BM","sourcesContent":["import cloneDeep from 'lodash/cloneDeep';\nimport find from 'lodash/find';\nimport isEmpty from 'lodash/isEmpty';\nimport isEqual from 'lodash/isEqual';\nimport isEqualWith from 'lodash/isEqualWith';\nimport merge from 'lodash/merge';\nimport omitBy from 'lodash/omitBy';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { partialScoring } from '@pie-lib/controller-utils';\nimport * as math from 'mathjs';\n\nimport defaults from './defaults';\n\nconst score = (number) => {\n return {\n score: {\n scaled: number,\n },\n };\n};\n\nconst getPartialScore = (corrected, ps) => {\n const { correct } = corrected;\n const rule = ps.find((r) => r.numberOfCorrect === correct.length);\n\n if (rule) {\n return 1.0 * (rule.scorePercentage / 100);\n } else {\n return 0;\n }\n};\n\nconst accumulateAnswer = (correctResponse) => (total, answer) => {\n const isCorrectResponse = correctResponse.some((cr) => matches(cr)(answer));\n return total + (isCorrectResponse ? 1 : 0);\n};\n\n/**\n */\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n } else {\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const numCorrect = (session.answer || []).reduce(accumulateAnswer(model.correctResponse), 0);\n\n let total = model.correctResponse.length;\n let numIncorrect = 0;\n\n if ((session.answer || []).length > total) {\n numIncorrect = (session.answer || []).length - total;\n }\n\n if (total === 0) {\n total = 1;\n }\n\n let score = numCorrect < 0 ? 0 : (numCorrect - numIncorrect) / total;\n\n if (score < 0) {\n score = 0;\n }\n\n resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0 });\n }\n });\n}\n\nexport function getScore(question, session) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: { scaled: 0 } });\n } else {\n session.answer = session.answer || [];\n\n const corrected = getCorrected(session.answer, cloneDeep(question.correctResponse));\n\n const correctness = getCorrectness(corrected);\n\n if (correctness === 'correct') {\n resolve(score(1.0));\n } else if (correctness === 'incorrect') {\n resolve(score(0.0));\n } else if (correctness === 'partial') {\n const { allowPartialScoring, partialScoring } = question;\n const ps = (partialScoring || []).filter((o) => !isEmpty(o));\n const canDoPartialScoring = allowPartialScoring && ps.length > 0;\n if (canDoPartialScoring) {\n resolve(score(getPartialScore(corrected, ps)));\n } else {\n resolve(score(0.0));\n }\n } else {\n resolve({ score: { scaled: -1 } });\n }\n }\n });\n}\n\nexport const CLOSE_TO_PRECISION = 3;\n\nexport const closeTo = (a, b, precision) => {\n precision = precision || 5;\n const expectedDiff = Math.pow(10, -precision) / 2;\n const receivedDiff = Math.abs(a - b);\n const close = receivedDiff <= expectedDiff;\n return close;\n};\n\nconst matches = (a) => (v) => {\n return isEqualWith(a, v, (v, ov) => {\n if (typeof v === 'number' && typeof ov === 'number') {\n return closeTo(v, ov, CLOSE_TO_PRECISION);\n }\n });\n};\n\nexport const getCorrected = (answer, correctResponse) => {\n if (isEmpty(correctResponse) && answer.length > 0) {\n return {\n correct: [],\n incorrect: [],\n notInAnswer: [],\n noCorrectResponse: true,\n };\n }\n\n return answer.reduce(\n (acc, a, index) => {\n const { correct, incorrect, notInAnswer } = acc;\n\n const match = find(notInAnswer, matches(a));\n if (match) {\n correct.push(index);\n notInAnswer.splice(notInAnswer.indexOf(match), 1);\n } else {\n incorrect.push(index);\n }\n\n return {\n correct: correct,\n incorrect: incorrect,\n notInAnswer: notInAnswer,\n };\n },\n {\n correct: [],\n incorrect: [],\n notInAnswer: correctResponse,\n },\n );\n};\n\nexport const getCorrectness = (corrected) => {\n const { incorrect, correct, notInAnswer, noCorrectResponse } = corrected;\n\n if (noCorrectResponse) {\n return 'unknown';\n }\n\n if (incorrect.length === 0 && correct.length === 0) {\n return 'unanswered';\n }\n\n if (incorrect.length === 0 && notInAnswer.length === 0) {\n return 'correct';\n }\n\n if (incorrect.length > 0 || notInAnswer.length > 0) {\n if (correct.length > 0) {\n return 'partial';\n } else {\n return 'incorrect';\n }\n }\n\n return 'unknown';\n};\n\n/**\n * A sample of a normalize function see:\n * https://github.com/pie-framework/pie-elements/issues/21\n */\nexport function normalize(question) {\n return new Promise((resolve) => {\n const feedback = merge(defaults.feedback, question.feedback);\n\n if (isEqual(feedback, question.feedback)) {\n return resolve({ ...question });\n } else {\n resolve({ ...question, feedback });\n }\n });\n}\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n const out = {\n ...model,\n graph: {\n ...defaults.graph,\n ...model.graph,\n },\n colorContrast: 'black_on_white',\n };\n\n resolve(omitBy(out, (v) => !v));\n });\n}\n\n// this function is duplicated in configure; at some point, use the same shared function\nconst updateTicks = (model) => {\n const { graph: { domain, labelStep, ticks = {} } = {} } = model;\n const { minor, major } = ticks;\n\n if (domain) {\n domain.min = Number((domain.min || 0).toFixed(2));\n domain.max = Number((domain.max || 0).toFixed(2));\n }\n\n if (labelStep && typeof labelStep === 'string' && labelStep.match(/^[1-9][0-9]*\\/[1-9][0-9]*$/g)) {\n model.graph.fraction = true;\n\n // update the ticks frequency and label value to match the label step if needed\n const step = math.evaluate(labelStep);\n\n if (step !== major) {\n ticks.major = step;\n ticks.minor = step / (major / minor);\n }\n }\n\n return model;\n};\n\nexport function model(question, session, env) {\n if (!question) {\n return Promise.reject(new Error('question is null'));\n }\n\n return new Promise(async (resolve, reject) => {\n const normalizedQuestion = await normalize(question);\n const { graph } = updateTicks(normalizedQuestion);\n\n if (graph) {\n const evaluateMode = env.mode === 'evaluate';\n\n const correctResponse = cloneDeep(normalizedQuestion.correctResponse);\n const corrected = evaluateMode && getCorrected(session ? session.answer || [] : [], correctResponse);\n const correctness = evaluateMode && getCorrectness(corrected);\n\n const { exhibitOnly } = graph;\n const disabled = env.mode !== 'gather' || exhibitOnly === true;\n\n const fb = evaluateMode\n ? getFeedbackForCorrectness(correctness, normalizedQuestion.feedback)\n : Promise.resolve(undefined);\n\n fb.then((feedbackMessage) => {\n const out = {\n prompt: normalizedQuestion.prompt,\n graph,\n disabled,\n corrected,\n correctResponse:\n evaluateMode && ['unanswered', 'correct'].indexOf(correctness) === -1 && normalizedQuestion.correctResponse,\n feedback: feedbackMessage && {\n type: correctness,\n message: feedbackMessage,\n },\n colorContrast: (env.accessibility && env.accessibility.colorContrast) || 'black_on_white',\n };\n\n resolve(omitBy(out, (v) => !v));\n });\n } else {\n reject(new Error('graph is undefined'));\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctResponse: answer } = question;\n\n resolve({\n answer,\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (model = {}) => {\n // TODO: add configurable validation props after authoring is updated\n const { graph, correctResponse } = model || {};\n const { width, domain, maxNumberOfPoints } = graph || {};\n const { min, max } = domain || {};\n const errors = {};\n\n if (width < 200 || width > 800) {\n errors.widthError = 'Width should be a value between 200 and 800.';\n }\n\n if (min < -100000 || min > 10000 || max < -100000 || max > 10000) {\n errors.domainError = 'Min and max must both be in the range [-100000, 10000].';\n }\n\n if (min >= max) {\n errors.maxError = 'Max must be greater than min.';\n }\n\n if (maxNumberOfPoints < 1 || maxNumberOfPoints > 20) {\n errors.pointsError = 'Max number of elements should be between 1 and 20.';\n }\n\n if (correctResponse && correctResponse.length === 0) {\n errors.correctResponseError = 'The correct answer should include at least one number line object.';\n }\n\n return errors;\n};\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["score","number","scaled","getPartialScore","corrected","ps","correct","rule","find","r","numberOfCorrect","length","scorePercentage","accumulateAnswer","correctResponse","total","answer","isCorrectResponse","some","cr","matches","outcome","model","session","env","Promise","resolve","empty","partialScoringEnabled","partialScoring","enabled","numCorrect","reduce","numIncorrect","getScore","question","getCorrected","correctness","getCorrectness","allowPartialScoring","filter","o","canDoPartialScoring","CLOSE_TO_PRECISION","closeTo","a","b","precision","expectedDiff","Math","pow","receivedDiff","abs","close","v","ov","incorrect","notInAnswer","noCorrectResponse","acc","index","match","push","splice","indexOf","normalize","feedback","defaults","createDefaultModel","out","graph","colorContrast","updateTicks","domain","labelStep","ticks","minor","major","min","Number","toFixed","max","fraction","step","math","evaluate","reject","Error","normalizedQuestion","evaluateMode","mode","exhibitOnly","disabled","fb","undefined","then","feedbackMessage","prompt","type","message","accessibility","language","createCorrectResponseSession","role","id","validate","width","maxNumberOfPoints","errors","widthError","domainError","maxError","pointsError","correctResponseError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;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,MAAexD,eAAf,SAAeA,eAAf;;AACA,cAA6CwD,KAAK,IAAI,EAAtD;AAAA,MAAQoC,KAAR,SAAQA,KAAR;AAAA,MAAejC,MAAf,SAAeA,MAAf;AAAA,MAAuBkC,iBAAvB,SAAuBA,iBAAvB;;AACA,cAAqBlC,MAAM,IAAI,EAA/B;AAAA,MAAQK,GAAR,SAAQA,GAAR;AAAA,MAAaG,GAAb,SAAaA,GAAb;;AACA,MAAM2B,MAAM,GAAG,EAAf;;AAEA,MAAIF,KAAK,GAAG,GAAR,IAAeA,KAAK,GAAG,GAA3B,EAAgC;AAC9BE,IAAAA,MAAM,CAACC,UAAP,GAAoB,8CAApB;AACD;;AAED,MAAI/B,GAAG,GAAG,CAAC,MAAP,IAAiBA,GAAG,GAAG,KAAvB,IAAgCG,GAAG,GAAG,CAAC,MAAvC,IAAiDA,GAAG,GAAG,KAA3D,EAAkE;AAChE2B,IAAAA,MAAM,CAACE,WAAP,GAAqB,yDAArB;AACD;;AAED,MAAIhC,GAAG,IAAIG,GAAX,EAAgB;AACd2B,IAAAA,MAAM,CAACG,QAAP,GAAkB,+BAAlB;AACD;;AAED,MAAIJ,iBAAiB,GAAG,CAApB,IAAyBA,iBAAiB,GAAG,EAAjD,EAAqD;AACnDC,IAAAA,MAAM,CAACI,WAAP,GAAqB,oDAArB;AACD;;AAED,MAAIlG,eAAe,IAAIA,eAAe,CAACH,MAAhB,KAA2B,CAAlD,EAAqD;AACnDiG,IAAAA,MAAM,CAACK,oBAAP,GAA8B,oEAA9B;AACD;;AAED,SAAOL,MAAP;AACD,CA5BM","sourcesContent":["import cloneDeep from 'lodash/cloneDeep';\nimport find from 'lodash/find';\nimport isEmpty from 'lodash/isEmpty';\nimport isEqual from 'lodash/isEqual';\nimport isEqualWith from 'lodash/isEqualWith';\nimport merge from 'lodash/merge';\nimport omitBy from 'lodash/omitBy';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { partialScoring } from '@pie-lib/controller-utils';\nimport * as math from 'mathjs';\n\nimport defaults from './defaults';\n\nconst score = (number) => {\n return {\n score: {\n scaled: number,\n },\n };\n};\n\nconst getPartialScore = (corrected, ps) => {\n const { correct } = corrected;\n const rule = ps.find((r) => r.numberOfCorrect === correct.length);\n\n if (rule) {\n return 1.0 * (rule.scorePercentage / 100);\n } else {\n return 0;\n }\n};\n\nconst accumulateAnswer = (correctResponse) => (total, answer) => {\n const isCorrectResponse = correctResponse.some((cr) => matches(cr)(answer));\n return total + (isCorrectResponse ? 1 : 0);\n};\n\n/**\n */\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n } else {\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const numCorrect = (session.answer || []).reduce(accumulateAnswer(model.correctResponse), 0);\n\n let total = model.correctResponse.length;\n let numIncorrect = 0;\n\n if ((session.answer || []).length > total) {\n numIncorrect = (session.answer || []).length - total;\n }\n\n if (total === 0) {\n total = 1;\n }\n\n let score = numCorrect < 0 ? 0 : (numCorrect - numIncorrect) / total;\n\n if (score < 0) {\n score = 0;\n }\n\n resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0 });\n }\n });\n}\n\nexport function getScore(question, session) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: { scaled: 0 } });\n } else {\n session.answer = session.answer || [];\n\n const corrected = getCorrected(session.answer, cloneDeep(question.correctResponse));\n\n const correctness = getCorrectness(corrected);\n\n if (correctness === 'correct') {\n resolve(score(1.0));\n } else if (correctness === 'incorrect') {\n resolve(score(0.0));\n } else if (correctness === 'partial') {\n const { allowPartialScoring, partialScoring } = question;\n const ps = (partialScoring || []).filter((o) => !isEmpty(o));\n const canDoPartialScoring = allowPartialScoring && ps.length > 0;\n if (canDoPartialScoring) {\n resolve(score(getPartialScore(corrected, ps)));\n } else {\n resolve(score(0.0));\n }\n } else {\n resolve({ score: { scaled: -1 } });\n }\n }\n });\n}\n\nexport const CLOSE_TO_PRECISION = 3;\n\nexport const closeTo = (a, b, precision) => {\n precision = precision || 5;\n const expectedDiff = Math.pow(10, -precision) / 2;\n const receivedDiff = Math.abs(a - b);\n const close = receivedDiff <= expectedDiff;\n return close;\n};\n\nconst matches = (a) => (v) => {\n return isEqualWith(a, v, (v, ov) => {\n if (typeof v === 'number' && typeof ov === 'number') {\n return closeTo(v, ov, CLOSE_TO_PRECISION);\n }\n });\n};\n\nexport const getCorrected = (answer, correctResponse) => {\n if (isEmpty(correctResponse) && answer.length > 0) {\n return {\n correct: [],\n incorrect: [],\n notInAnswer: [],\n noCorrectResponse: true,\n };\n }\n\n return answer.reduce(\n (acc, a, index) => {\n const { correct, incorrect, notInAnswer } = acc;\n\n const match = find(notInAnswer, matches(a));\n if (match) {\n correct.push(index);\n notInAnswer.splice(notInAnswer.indexOf(match), 1);\n } else {\n incorrect.push(index);\n }\n\n return {\n correct: correct,\n incorrect: incorrect,\n notInAnswer: notInAnswer,\n };\n },\n {\n correct: [],\n incorrect: [],\n notInAnswer: correctResponse,\n },\n );\n};\n\nexport const getCorrectness = (corrected) => {\n const { incorrect, correct, notInAnswer, noCorrectResponse } = corrected;\n\n if (noCorrectResponse) {\n return 'unknown';\n }\n\n if (incorrect.length === 0 && correct.length === 0) {\n return 'unanswered';\n }\n\n if (incorrect.length === 0 && notInAnswer.length === 0) {\n return 'correct';\n }\n\n if (incorrect.length > 0 || notInAnswer.length > 0) {\n if (correct.length > 0) {\n return 'partial';\n } else {\n return 'incorrect';\n }\n }\n\n return 'unknown';\n};\n\n/**\n * A sample of a normalize function see:\n * https://github.com/pie-framework/pie-elements/issues/21\n */\nexport function normalize(question) {\n return new Promise((resolve) => {\n const feedback = merge(defaults.feedback, question.feedback);\n\n if (isEqual(feedback, question.feedback)) {\n return resolve({ ...question });\n } else {\n resolve({ ...question, feedback });\n }\n });\n}\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n const out = {\n ...model,\n graph: {\n ...defaults.graph,\n ...model.graph,\n },\n colorContrast: 'black_on_white',\n };\n\n resolve(omitBy(out, (v) => !v));\n });\n}\n\n// this function is duplicated in configure; at some point, use the same shared function\nconst updateTicks = (model) => {\n const { graph: { domain, labelStep, ticks = {} } = {} } = model;\n const { minor, major } = ticks;\n\n if (domain) {\n domain.min = Number((domain.min || 0).toFixed(2));\n domain.max = Number((domain.max || 0).toFixed(2));\n }\n\n if (labelStep && typeof labelStep === 'string' && labelStep.match(/^[1-9][0-9]*\\/[1-9][0-9]*$/g)) {\n model.graph.fraction = true;\n\n // update the ticks frequency and label value to match the label step if needed\n const step = math.evaluate(labelStep);\n\n if (step !== major) {\n ticks.major = step;\n ticks.minor = step / (major / minor);\n }\n }\n\n return model;\n};\n\nexport function model(question, session, env) {\n if (!question) {\n return Promise.reject(new Error('question is null'));\n }\n\n return new Promise(async (resolve, reject) => {\n const normalizedQuestion = await normalize(question);\n const { graph } = updateTicks(normalizedQuestion);\n\n if (graph) {\n const evaluateMode = env.mode === 'evaluate';\n\n const correctResponse = cloneDeep(normalizedQuestion.correctResponse);\n const corrected = evaluateMode && getCorrected(session ? session.answer || [] : [], correctResponse);\n const correctness = evaluateMode && getCorrectness(corrected);\n\n const { exhibitOnly } = graph;\n const disabled = env.mode !== 'gather' || exhibitOnly === true;\n\n const fb = evaluateMode\n ? getFeedbackForCorrectness(correctness, normalizedQuestion.feedback)\n : Promise.resolve(undefined);\n\n fb.then((feedbackMessage) => {\n const out = {\n prompt: normalizedQuestion.prompt,\n graph,\n disabled,\n corrected,\n correctResponse:\n evaluateMode && ['unanswered', 'correct'].indexOf(correctness) === -1 && normalizedQuestion.correctResponse,\n feedback: feedbackMessage && {\n type: correctness,\n message: feedbackMessage,\n },\n colorContrast: (env.accessibility && env.accessibility.colorContrast) || 'black_on_white',\n language: normalizedQuestion.language,\n };\n\n resolve(omitBy(out, (v) => !v));\n });\n } else {\n reject(new Error('graph is undefined'));\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctResponse: answer } = question;\n\n resolve({\n answer,\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (model = {}) => {\n // TODO: add configurable validation props after authoring is updated\n const { graph, correctResponse } = model || {};\n const { width, domain, maxNumberOfPoints } = graph || {};\n const { min, max } = domain || {};\n const errors = {};\n\n if (width < 200 || width > 800) {\n errors.widthError = 'Width should be a value between 200 and 800.';\n }\n\n if (min < -100000 || min > 10000 || max < -100000 || max > 10000) {\n errors.domainError = 'Min and max must both be in the range [-100000, 10000].';\n }\n\n if (min >= max) {\n errors.maxError = 'Max must be greater than min.';\n }\n\n if (maxNumberOfPoints < 1 || maxNumberOfPoints > 20) {\n errors.pointsError = 'Max number of elements should be between 1 and 20.';\n }\n\n if (correctResponse && correctResponse.length === 0) {\n errors.correctResponseError = 'The correct answer should include at least one number line object.';\n }\n\n return errors;\n};\n"],"file":"index.js"}
|
package/controller/package.json
CHANGED
package/docs/config-schema.json
CHANGED
|
@@ -35,6 +35,82 @@
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
+
"mathMlOptions": {
|
|
39
|
+
"title": "ConfigureMathMLProp",
|
|
40
|
+
"type": "object",
|
|
41
|
+
"properties": {
|
|
42
|
+
"mmlOutput": {
|
|
43
|
+
"description": "Indicates if model should have mathML output instead of latex",
|
|
44
|
+
"type": "number",
|
|
45
|
+
"title": "mmlOutput"
|
|
46
|
+
},
|
|
47
|
+
"mmlEditing": {
|
|
48
|
+
"description": "Indicates if mathML that's already in model should be editable",
|
|
49
|
+
"type": "number",
|
|
50
|
+
"title": "mmlEditing"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"language": {
|
|
55
|
+
"title": "ConfigurePropWithEnabled",
|
|
56
|
+
"type": "object",
|
|
57
|
+
"properties": {
|
|
58
|
+
"settings": {
|
|
59
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"title": "settings"
|
|
62
|
+
},
|
|
63
|
+
"label": {
|
|
64
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
65
|
+
"type": "string",
|
|
66
|
+
"title": "label"
|
|
67
|
+
},
|
|
68
|
+
"enabled": {
|
|
69
|
+
"description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
|
|
70
|
+
"type": "boolean",
|
|
71
|
+
"title": "enabled"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"languageChoices": {
|
|
76
|
+
"description": "Language choices configuration\nOnly available if language is enabled",
|
|
77
|
+
"type": "object",
|
|
78
|
+
"properties": {
|
|
79
|
+
"label": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"title": "label"
|
|
82
|
+
},
|
|
83
|
+
"options": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": {
|
|
86
|
+
"title": "ConfigureLanguageOptionsProp",
|
|
87
|
+
"type": "object",
|
|
88
|
+
"properties": {
|
|
89
|
+
"value": {
|
|
90
|
+
"description": "Value of the language option",
|
|
91
|
+
"type": "string",
|
|
92
|
+
"title": "value"
|
|
93
|
+
},
|
|
94
|
+
"label": {
|
|
95
|
+
"description": "Label of the language option",
|
|
96
|
+
"type": "string",
|
|
97
|
+
"title": "label"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"required": [
|
|
101
|
+
"label",
|
|
102
|
+
"value"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"title": "options"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"required": [
|
|
109
|
+
"label",
|
|
110
|
+
"options"
|
|
111
|
+
],
|
|
112
|
+
"title": "languageChoices"
|
|
113
|
+
},
|
|
38
114
|
"showPrompt": {
|
|
39
115
|
"description": "Determines whether prompt field will be displayed or not",
|
|
40
116
|
"default": true,
|
|
@@ -114,6 +190,63 @@
|
|
|
114
190
|
"title": "label"
|
|
115
191
|
}
|
|
116
192
|
}
|
|
193
|
+
},
|
|
194
|
+
"ConfigureMathMLProp": {
|
|
195
|
+
"title": "ConfigureMathMLProp",
|
|
196
|
+
"type": "object",
|
|
197
|
+
"properties": {
|
|
198
|
+
"mmlOutput": {
|
|
199
|
+
"description": "Indicates if model should have mathML output instead of latex",
|
|
200
|
+
"type": "number",
|
|
201
|
+
"title": "mmlOutput"
|
|
202
|
+
},
|
|
203
|
+
"mmlEditing": {
|
|
204
|
+
"description": "Indicates if mathML that's already in model should be editable",
|
|
205
|
+
"type": "number",
|
|
206
|
+
"title": "mmlEditing"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"ConfigurePropWithEnabled": {
|
|
211
|
+
"title": "ConfigurePropWithEnabled",
|
|
212
|
+
"type": "object",
|
|
213
|
+
"properties": {
|
|
214
|
+
"settings": {
|
|
215
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
216
|
+
"type": "boolean",
|
|
217
|
+
"title": "settings"
|
|
218
|
+
},
|
|
219
|
+
"label": {
|
|
220
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
221
|
+
"type": "string",
|
|
222
|
+
"title": "label"
|
|
223
|
+
},
|
|
224
|
+
"enabled": {
|
|
225
|
+
"description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
|
|
226
|
+
"type": "boolean",
|
|
227
|
+
"title": "enabled"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"ConfigureLanguageOptionsProp": {
|
|
232
|
+
"title": "ConfigureLanguageOptionsProp",
|
|
233
|
+
"type": "object",
|
|
234
|
+
"properties": {
|
|
235
|
+
"value": {
|
|
236
|
+
"description": "Value of the language option",
|
|
237
|
+
"type": "string",
|
|
238
|
+
"title": "value"
|
|
239
|
+
},
|
|
240
|
+
"label": {
|
|
241
|
+
"description": "Label of the language option",
|
|
242
|
+
"type": "string",
|
|
243
|
+
"title": "label"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"required": [
|
|
247
|
+
"label",
|
|
248
|
+
"value"
|
|
249
|
+
]
|
|
117
250
|
}
|
|
118
251
|
},
|
|
119
252
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
@@ -26,6 +26,58 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
26
26
|
|
|
27
27
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
28
28
|
|
|
29
|
+
# `mathMlOptions` (object)
|
|
30
|
+
|
|
31
|
+
Properties of the `mathMlOptions` object:
|
|
32
|
+
|
|
33
|
+
## `mmlOutput` (number)
|
|
34
|
+
|
|
35
|
+
Indicates if model should have mathML output instead of latex
|
|
36
|
+
|
|
37
|
+
## `mmlEditing` (number)
|
|
38
|
+
|
|
39
|
+
Indicates if mathML that's already in model should be editable
|
|
40
|
+
|
|
41
|
+
# `language` (object)
|
|
42
|
+
|
|
43
|
+
Properties of the `language` object:
|
|
44
|
+
|
|
45
|
+
## `settings` (boolean)
|
|
46
|
+
|
|
47
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
48
|
+
|
|
49
|
+
## `label` (string)
|
|
50
|
+
|
|
51
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
52
|
+
|
|
53
|
+
## `enabled` (boolean)
|
|
54
|
+
|
|
55
|
+
Indicates the value of the item if it affects config-ui
|
|
56
|
+
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
57
|
+
|
|
58
|
+
# `languageChoices` (object)
|
|
59
|
+
|
|
60
|
+
Language choices configuration
|
|
61
|
+
Only available if language is enabled
|
|
62
|
+
|
|
63
|
+
Properties of the `languageChoices` object:
|
|
64
|
+
|
|
65
|
+
## `label` (string, required)
|
|
66
|
+
|
|
67
|
+
## `options` (array, required)
|
|
68
|
+
|
|
69
|
+
The object is an array with all elements of the type `object`.
|
|
70
|
+
|
|
71
|
+
The array object has the following properties:
|
|
72
|
+
|
|
73
|
+
### `value` (string, required)
|
|
74
|
+
|
|
75
|
+
Value of the language option
|
|
76
|
+
|
|
77
|
+
### `label` (string, required)
|
|
78
|
+
|
|
79
|
+
Label of the language option
|
|
80
|
+
|
|
29
81
|
# `showPrompt` (boolean)
|
|
30
82
|
|
|
31
83
|
Determines whether prompt field will be displayed or not
|
|
@@ -94,4 +146,45 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
94
146
|
|
|
95
147
|
### `label` (string)
|
|
96
148
|
|
|
97
|
-
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
149
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
150
|
+
|
|
151
|
+
## `ConfigureMathMLProp` (object)
|
|
152
|
+
|
|
153
|
+
Properties of the `ConfigureMathMLProp` object:
|
|
154
|
+
|
|
155
|
+
### `mmlOutput` (number)
|
|
156
|
+
|
|
157
|
+
Indicates if model should have mathML output instead of latex
|
|
158
|
+
|
|
159
|
+
### `mmlEditing` (number)
|
|
160
|
+
|
|
161
|
+
Indicates if mathML that's already in model should be editable
|
|
162
|
+
|
|
163
|
+
## `ConfigurePropWithEnabled` (object)
|
|
164
|
+
|
|
165
|
+
Properties of the `ConfigurePropWithEnabled` object:
|
|
166
|
+
|
|
167
|
+
### `settings` (boolean)
|
|
168
|
+
|
|
169
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
170
|
+
|
|
171
|
+
### `label` (string)
|
|
172
|
+
|
|
173
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
174
|
+
|
|
175
|
+
### `enabled` (boolean)
|
|
176
|
+
|
|
177
|
+
Indicates the value of the item if it affects config-ui
|
|
178
|
+
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
179
|
+
|
|
180
|
+
## `ConfigureLanguageOptionsProp` (object)
|
|
181
|
+
|
|
182
|
+
Properties of the `ConfigureLanguageOptionsProp` object:
|
|
183
|
+
|
|
184
|
+
### `value` (string, required)
|
|
185
|
+
|
|
186
|
+
Value of the language option
|
|
187
|
+
|
|
188
|
+
### `label` (string, required)
|
|
189
|
+
|
|
190
|
+
Label of the language option
|
package/docs/pie-schema.json
CHANGED
|
@@ -658,6 +658,11 @@
|
|
|
658
658
|
"type": "string",
|
|
659
659
|
"title": "toolbarEditorPosition"
|
|
660
660
|
},
|
|
661
|
+
"language": {
|
|
662
|
+
"description": "Indicates the language of the component\nSupported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX",
|
|
663
|
+
"type": "string",
|
|
664
|
+
"title": "language"
|
|
665
|
+
},
|
|
661
666
|
"id": {
|
|
662
667
|
"description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
|
|
663
668
|
"type": "string",
|
|
@@ -694,6 +699,63 @@
|
|
|
694
699
|
}
|
|
695
700
|
}
|
|
696
701
|
},
|
|
702
|
+
"ConfigureMathMLProp": {
|
|
703
|
+
"title": "ConfigureMathMLProp",
|
|
704
|
+
"type": "object",
|
|
705
|
+
"properties": {
|
|
706
|
+
"mmlOutput": {
|
|
707
|
+
"description": "Indicates if model should have mathML output instead of latex",
|
|
708
|
+
"type": "number",
|
|
709
|
+
"title": "mmlOutput"
|
|
710
|
+
},
|
|
711
|
+
"mmlEditing": {
|
|
712
|
+
"description": "Indicates if mathML that's already in model should be editable",
|
|
713
|
+
"type": "number",
|
|
714
|
+
"title": "mmlEditing"
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
"ConfigurePropWithEnabled": {
|
|
719
|
+
"title": "ConfigurePropWithEnabled",
|
|
720
|
+
"type": "object",
|
|
721
|
+
"properties": {
|
|
722
|
+
"settings": {
|
|
723
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
724
|
+
"type": "boolean",
|
|
725
|
+
"title": "settings"
|
|
726
|
+
},
|
|
727
|
+
"label": {
|
|
728
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
729
|
+
"type": "string",
|
|
730
|
+
"title": "label"
|
|
731
|
+
},
|
|
732
|
+
"enabled": {
|
|
733
|
+
"description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
|
|
734
|
+
"type": "boolean",
|
|
735
|
+
"title": "enabled"
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
"ConfigureLanguageOptionsProp": {
|
|
740
|
+
"title": "ConfigureLanguageOptionsProp",
|
|
741
|
+
"type": "object",
|
|
742
|
+
"properties": {
|
|
743
|
+
"value": {
|
|
744
|
+
"description": "Value of the language option",
|
|
745
|
+
"type": "string",
|
|
746
|
+
"title": "value"
|
|
747
|
+
},
|
|
748
|
+
"label": {
|
|
749
|
+
"description": "Label of the language option",
|
|
750
|
+
"type": "string",
|
|
751
|
+
"title": "label"
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
"required": [
|
|
755
|
+
"label",
|
|
756
|
+
"value"
|
|
757
|
+
]
|
|
758
|
+
},
|
|
697
759
|
"ComplexFeedbackType": {
|
|
698
760
|
"title": "ComplexFeedbackType",
|
|
699
761
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -159,6 +159,11 @@ This element must be one of the following enum values:
|
|
|
159
159
|
|
|
160
160
|
Default: `": 'bottom'"`
|
|
161
161
|
|
|
162
|
+
# `language` (string)
|
|
163
|
+
|
|
164
|
+
Indicates the language of the component
|
|
165
|
+
Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX
|
|
166
|
+
|
|
162
167
|
# `id` (string, required)
|
|
163
168
|
|
|
164
169
|
Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
|
|
@@ -185,6 +190,47 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
185
190
|
|
|
186
191
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
187
192
|
|
|
193
|
+
## `ConfigureMathMLProp` (object)
|
|
194
|
+
|
|
195
|
+
Properties of the `ConfigureMathMLProp` object:
|
|
196
|
+
|
|
197
|
+
### `mmlOutput` (number)
|
|
198
|
+
|
|
199
|
+
Indicates if model should have mathML output instead of latex
|
|
200
|
+
|
|
201
|
+
### `mmlEditing` (number)
|
|
202
|
+
|
|
203
|
+
Indicates if mathML that's already in model should be editable
|
|
204
|
+
|
|
205
|
+
## `ConfigurePropWithEnabled` (object)
|
|
206
|
+
|
|
207
|
+
Properties of the `ConfigurePropWithEnabled` object:
|
|
208
|
+
|
|
209
|
+
### `settings` (boolean)
|
|
210
|
+
|
|
211
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
212
|
+
|
|
213
|
+
### `label` (string)
|
|
214
|
+
|
|
215
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
216
|
+
|
|
217
|
+
### `enabled` (boolean)
|
|
218
|
+
|
|
219
|
+
Indicates the value of the item if it affects config-ui
|
|
220
|
+
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
221
|
+
|
|
222
|
+
## `ConfigureLanguageOptionsProp` (object)
|
|
223
|
+
|
|
224
|
+
Properties of the `ConfigureLanguageOptionsProp` object:
|
|
225
|
+
|
|
226
|
+
### `value` (string, required)
|
|
227
|
+
|
|
228
|
+
Value of the language option
|
|
229
|
+
|
|
230
|
+
### `label` (string, required)
|
|
231
|
+
|
|
232
|
+
Label of the language option
|
|
233
|
+
|
|
188
234
|
## `ComplexFeedbackType` (object)
|
|
189
235
|
|
|
190
236
|
Properties of the `ComplexFeedbackType` object:
|
package/lib/number-line/index.js
CHANGED
|
@@ -55,10 +55,13 @@ var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
|
|
|
55
55
|
|
|
56
56
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
57
57
|
|
|
58
|
+
var _translator = _interopRequireDefault(require("@pie-lib/translator"));
|
|
59
|
+
|
|
58
60
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
59
61
|
|
|
60
62
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
61
63
|
|
|
64
|
+
var translator = _translator["default"].translator;
|
|
62
65
|
var styles = {
|
|
63
66
|
mainContainer: {
|
|
64
67
|
color: _renderUi.color.text(),
|
|
@@ -259,7 +262,8 @@ var NumberLine = /*#__PURE__*/function (_React$Component) {
|
|
|
259
262
|
prompt = model.prompt,
|
|
260
263
|
emptyAnswer = model.emptyAnswer,
|
|
261
264
|
feedback = model.feedback,
|
|
262
|
-
colorContrast = model.colorContrast
|
|
265
|
+
colorContrast = model.colorContrast,
|
|
266
|
+
language = model.language;
|
|
263
267
|
var addElement = this.addElement.bind(this);
|
|
264
268
|
var elementsSelected = !disabled && selectedElements && selectedElements.length > 0;
|
|
265
269
|
var ticks = graph.ticks,
|
|
@@ -300,7 +304,13 @@ var NumberLine = /*#__PURE__*/function (_React$Component) {
|
|
|
300
304
|
var elements = showCorrectAnswer ? getCorrectAnswerElements() : getAnswerElements();
|
|
301
305
|
|
|
302
306
|
var maxPointsMessage = function maxPointsMessage() {
|
|
303
|
-
return
|
|
307
|
+
return maxNumberOfPoints == 1 ? translator.t('numberLine.addElementLimit_one', {
|
|
308
|
+
lng: language,
|
|
309
|
+
count: 1
|
|
310
|
+
}) : translator.t('numberLine.addElementLimit_other', {
|
|
311
|
+
lng: language,
|
|
312
|
+
count: maxNumberOfPoints
|
|
313
|
+
});
|
|
304
314
|
};
|
|
305
315
|
|
|
306
316
|
var deleteElements = function deleteElements() {
|
|
@@ -361,7 +371,8 @@ var NumberLine = /*#__PURE__*/function (_React$Component) {
|
|
|
361
371
|
onElementType: this.elementTypeSelected.bind(this),
|
|
362
372
|
onClearElements: this.clearAll.bind(this),
|
|
363
373
|
onUndoElement: this.undo.bind(this),
|
|
364
|
-
icons: getIcons()
|
|
374
|
+
icons: getIcons(),
|
|
375
|
+
language: language
|
|
365
376
|
}), /*#__PURE__*/_react["default"].createElement(_graph["default"], (0, _extends2["default"])({}, graphProps, {
|
|
366
377
|
elements: elements,
|
|
367
378
|
onAddElement: addElement,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/number-line/index.jsx"],"names":["styles","mainContainer","color","text","backgroundColor","background","graphTitle","textAlign","pointerEvents","userSelect","numberLine","boxSizing","toggle","marginBottom","black_on_rose","white_on_black","prompt","verticalAlign","NumberLine","props","context","initialType","model","graph","toLowerCase","PointChooser","DEFAULT_TYPE","state","selectedElements","elementType","answers","answer","index","selected","indexOf","concat","filter","e","setState","t","x","hasMaxNoOfPoints","showMaxPointsWarning","setTimeout","ticks","domain","elementData","minor","contains","some","element","push","onAddElement","maxNumberOfPoints","length","nextProps","showCorrectAnswer","type","min","max","defaultValue","Math","onUndoElement","pop","onClearElements","classes","onDeleteElements","onMoveElement","corrected","correct","incorrect","disabled","correctResponse","emptyAnswer","feedback","colorContrast","addElement","bind","elementsSelected","arrows","height","availableTypes","title","fraction","width","getSize","graphProps","getAnswerElements","map","out","includes","undefined","getCorrectAnswerElements","r","elements","maxPointsMessage","deleteElements","v","d","getIcons","Object","keys","k","onShowCorrectAnswer","show","adjustedWidth","names","elementTypeSelected","clearAll","undo","toggleElement","deselectElements","__html","React","Component","PropTypes","func","isRequired","object","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;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AAC,oBAAD,gCAAckB,QAAd;AAAwB,QAAA,KAAK,EAAE+B;AAA/B,SAxCrC,CADF;AA4CD;;;EA/O6BQ,kBAAMC,S;;;iCAAzBhG,U,eACQ;AACjBiD,EAAAA,aAAa,EAAEgD,sBAAUC,IAAV,CAAeC,UADb;AAEjBnD,EAAAA,gBAAgB,EAAEiD,sBAAUC,IAAV,CAAeC,UAFhB;AAGjBjE,EAAAA,YAAY,EAAE+D,sBAAUC,IAAV,CAAeC,UAHZ;AAIjBvD,EAAAA,aAAa,EAAEqD,sBAAUC,IAAV,CAAeC,UAJb;AAKjBrD,EAAAA,eAAe,EAAEmD,sBAAUC,IAAV,CAAeC,UALf;AAMjB/F,EAAAA,KAAK,EAAE6F,sBAAUG,MAAV,CAAiBD,UANP;AAOjBtF,EAAAA,MAAM,EAAEoF,sBAAUI,KAPD;AAQjBtD,EAAAA,OAAO,EAAEkD,sBAAUG,MAAV,CAAiBD;AART,C;;eAiPN,0BAAYrH,MAAZ,EAAoBkB,UAApB,C","sourcesContent":["import Feedback from './feedback';\nimport Graph from './graph';\nimport PropTypes from 'prop-types';\nimport PointChooser from './point-chooser';\nimport React from 'react';\nimport Toggle from '@pie-lib/correct-answer-toggle';\nimport { buildElementModel } from './graph/elements/builder';\nimport classNames from 'classnames';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { color, PreviewPrompt } from '@pie-lib/render-ui';\nimport injectSheet from 'react-jss';\nimport isArray from 'lodash/isArray';\nimport isNumber from 'lodash/isNumber';\nimport isEqual from 'lodash/isEqual';\n\nexport { Graph };\n\nconst styles = {\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n },\n graphTitle: {\n textAlign: 'center',\n pointerEvents: 'none',\n userSelect: 'none',\n },\n numberLine: {\n boxSizing: 'unset',\n },\n toggle: {\n marginBottom: '16px',\n },\n black_on_rose: {\n backgroundColor: 'mistyrose',\n },\n white_on_black: {\n backgroundColor: 'black',\n '--correct-answer-toggle-label-color': 'white',\n '--tick-color': 'white',\n '--line-stroke': 'white',\n '--arrow-color': 'white',\n '--point-stroke': 'white',\n '--point-fill': 'black',\n },\n prompt: {\n verticalAlign: 'middle',\n marginBottom: '16px',\n },\n};\n\nexport class NumberLine extends React.Component {\n static propTypes = {\n onMoveElement: PropTypes.func.isRequired,\n onDeleteElements: PropTypes.func.isRequired,\n onAddElement: PropTypes.func.isRequired,\n onUndoElement: PropTypes.func.isRequired,\n onClearElements: PropTypes.func.isRequired,\n model: PropTypes.object.isRequired,\n answer: PropTypes.array,\n classes: PropTypes.object.isRequired,\n };\n\n constructor(props, context) {\n super(props, context);\n\n let initialType = props.model.graph ? props.model.graph.initialType : null;\n initialType = initialType ? initialType.toLowerCase() : PointChooser.DEFAULT_TYPE;\n\n this.state = {\n selectedElements: [],\n elementType: initialType,\n answers: props.answer,\n };\n }\n\n toggleElement(index) {\n let selected = [];\n if (this.state.selectedElements.indexOf(index) === -1) {\n selected = this.state.selectedElements.concat([index]);\n } else {\n selected = this.state.selectedElements.filter((e) => e !== index);\n }\n this.setState({ selectedElements: selected });\n }\n\n elementTypeSelected(t) {\n this.setState({ elementType: t });\n }\n\n addElement(x) {\n if (this.hasMaxNoOfPoints()) {\n this.setState({ showMaxPointsWarning: true });\n setTimeout(() => {\n this.setState({ showMaxPointsWarning: false });\n }, 2000);\n return;\n }\n\n const { ticks, domain } = this.props.model.graph;\n\n let elementData = buildElementModel(x, this.state.elementType, domain, ticks.minor);\n\n if (elementData) {\n const { answers } = this.state;\n\n const contains = answers.some((element) => {\n return isEqual(element, elementData);\n });\n\n if (!contains) {\n answers.push(elementData);\n this.setState({ answers });\n this.props.onAddElement(elementData);\n }\n }\n }\n\n hasMaxNoOfPoints() {\n let {\n answer,\n model: {\n graph: { maxNumberOfPoints },\n },\n } = this.props;\n\n return isNumber(maxNumberOfPoints) && maxNumberOfPoints > 0 && (answer || []).length >= maxNumberOfPoints;\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { answer } = nextProps;\n\n if (!isEqual(this.state.answers, answer)) {\n this.setState({ showCorrectAnswer: false, answers: answer });\n }\n }\n\n deselectElements() {\n this.setState({ selectedElements: [] });\n }\n\n getSize(type, min, max, defaultValue) {\n const {\n model: { graph },\n } = this.props;\n\n if (graph && graph[type]) {\n return Math.max(min, Math.min(max, graph[type]));\n } else {\n return defaultValue;\n }\n }\n\n undo() {\n const { answers } = this.state;\n const { onUndoElement } = this.props;\n\n answers.pop();\n this.setState({ answers });\n onUndoElement();\n }\n\n clearAll() {\n const { onClearElements } = this.props;\n\n this.setState({ answers: [] });\n onClearElements();\n }\n\n render() {\n let { model, classes, onDeleteElements, onMoveElement } = this.props;\n let { showCorrectAnswer, answers, selectedElements, showMaxPointsWarning, elementType } = this.state;\n let {\n corrected = { correct: [], incorrect: [] },\n disabled,\n graph,\n correctResponse,\n prompt,\n emptyAnswer,\n feedback,\n colorContrast,\n } = model;\n let addElement = this.addElement.bind(this);\n let elementsSelected = !disabled && selectedElements && selectedElements.length > 0;\n const { ticks, domain, arrows, maxNumberOfPoints, height, availableTypes, title, fraction } = graph;\n const width = this.getSize('width', 400, 1600, 600);\n const graphProps = {\n disabled,\n domain,\n ticks,\n width,\n height: height || 100,\n arrows,\n fraction,\n };\n\n let getAnswerElements = () => {\n return (answers || []).map((e, index) => {\n let out = cloneDeep(e);\n out.selected = selectedElements.indexOf(index) !== -1;\n out.correct = corrected.correct.includes(index)\n ? true\n : corrected.incorrect.includes(index)\n ? false\n : undefined;\n return out;\n });\n };\n\n let getCorrectAnswerElements = () => {\n return (correctResponse || []).map((r) => {\n r.correct = true;\n return r;\n });\n };\n\n let elements = showCorrectAnswer ? getCorrectAnswerElements() : getAnswerElements();\n\n let maxPointsMessage = () => `You can only add ${maxNumberOfPoints} element${maxNumberOfPoints == 1 ? '' : 's'}`;\n\n let deleteElements = () => {\n onDeleteElements(selectedElements);\n\n answers = answers.filter((v, index) => {\n return !selectedElements.some((d) => d === index);\n });\n\n this.setState({ selectedElements: [], answers });\n };\n\n let getIcons = () => {\n if (availableTypes) {\n return Object.keys(availableTypes)\n .filter((k) => availableTypes[k])\n .map((k) => k.toLowerCase());\n }\n };\n\n let onShowCorrectAnswer = (show) => {\n this.setState({ showCorrectAnswer: show });\n };\n\n let adjustedWidth = graphProps.width - 20;\n\n const names = classNames(classes.numberLine, classes.mainContainer, classes[colorContrast]);\n\n return (\n <div className={names} style={{ width }}>\n {prompt && (\n <div className={classes.prompt}>\n <PreviewPrompt prompt={prompt} />\n </div>\n )}\n\n <div style={{ width: adjustedWidth }} className={classes.toggle}>\n <Toggle\n show={isArray(correctResponse) && correctResponse.length && !emptyAnswer}\n toggled={showCorrectAnswer}\n onToggle={onShowCorrectAnswer}\n initialValue={false}\n />\n </div>\n\n {!disabled && (\n <PointChooser\n elementType={elementType}\n showDeleteButton={elementsSelected}\n onDeleteClick={deleteElements}\n onElementType={this.elementTypeSelected.bind(this)}\n onClearElements={this.clearAll.bind(this)}\n onUndoElement={this.undo.bind(this)}\n icons={getIcons()}\n />\n )}\n\n <Graph\n {...graphProps}\n elements={elements}\n onAddElement={addElement}\n onMoveElement={onMoveElement}\n onToggleElement={this.toggleElement.bind(this)}\n onDeselectElements={this.deselectElements.bind(this)}\n debug={false}\n />\n {title && <div className={classes.graphTitle} dangerouslySetInnerHTML={{ __html: title }} />}\n\n {showMaxPointsWarning && <Feedback type=\"info\" width={adjustedWidth} message={maxPointsMessage()} />}\n {feedback && !showCorrectAnswer && <Feedback {...feedback} width={adjustedWidth} />}\n </div>\n );\n }\n}\n\nexport default injectSheet(styles)(NumberLine);\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/number-line/index.jsx"],"names":["translator","Translator","styles","mainContainer","color","text","backgroundColor","background","graphTitle","textAlign","pointerEvents","userSelect","numberLine","boxSizing","toggle","marginBottom","black_on_rose","white_on_black","prompt","verticalAlign","NumberLine","props","context","initialType","model","graph","toLowerCase","PointChooser","DEFAULT_TYPE","state","selectedElements","elementType","answers","answer","index","selected","indexOf","concat","filter","e","setState","t","x","hasMaxNoOfPoints","showMaxPointsWarning","setTimeout","ticks","domain","elementData","minor","contains","some","element","push","onAddElement","maxNumberOfPoints","length","nextProps","showCorrectAnswer","type","min","max","defaultValue","Math","onUndoElement","pop","onClearElements","classes","onDeleteElements","onMoveElement","corrected","correct","incorrect","disabled","correctResponse","emptyAnswer","feedback","colorContrast","language","addElement","bind","elementsSelected","arrows","height","availableTypes","title","fraction","width","getSize","graphProps","getAnswerElements","map","out","includes","undefined","getCorrectAnswerElements","r","elements","maxPointsMessage","lng","count","deleteElements","v","d","getIcons","Object","keys","k","onShowCorrectAnswer","show","adjustedWidth","names","elementTypeSelected","clearAll","undo","toggleElement","deselectElements","__html","React","Component","PropTypes","func","isRequired","object","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;AAIA,IAAME,MAAM,GAAG;AACbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADM;AAEbC,IAAAA,eAAe,EAAEF,gBAAMG,UAAN;AAFJ,GADF;AAKbC,EAAAA,UAAU,EAAE;AACVC,IAAAA,SAAS,EAAE,QADD;AAEVC,IAAAA,aAAa,EAAE,MAFL;AAGVC,IAAAA,UAAU,EAAE;AAHF,GALC;AAUbC,EAAAA,UAAU,EAAE;AACVC,IAAAA,SAAS,EAAE;AADD,GAVC;AAabC,EAAAA,MAAM,EAAE;AACNC,IAAAA,YAAY,EAAE;AADR,GAbK;AAgBbC,EAAAA,aAAa,EAAE;AACbV,IAAAA,eAAe,EAAE;AADJ,GAhBF;AAmBbW,EAAAA,cAAc,EAAE;AACdX,IAAAA,eAAe,EAAE,OADH;AAEd,2CAAuC,OAFzB;AAGd,oBAAgB,OAHF;AAId,qBAAi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Y,EAAEkE,sBAAUC,IAAV,CAAeC,UAHZ;AAIjB1D,EAAAA,aAAa,EAAEwD,sBAAUC,IAAV,CAAeC,UAJb;AAKjBxD,EAAAA,eAAe,EAAEsD,sBAAUC,IAAV,CAAeC,UALf;AAMjBlG,EAAAA,KAAK,EAAEgG,sBAAUG,MAAV,CAAiBD,UANP;AAOjBzF,EAAAA,MAAM,EAAEuF,sBAAUI,KAPD;AAQjBzD,EAAAA,OAAO,EAAEqD,sBAAUG,MAAV,CAAiBD;AART,C;;eAsPN,0BAAYxH,MAAZ,EAAoBkB,UAApB,C","sourcesContent":["import Feedback from './feedback';\nimport Graph from './graph';\nimport PropTypes from 'prop-types';\nimport PointChooser from './point-chooser';\nimport React from 'react';\nimport Toggle from '@pie-lib/correct-answer-toggle';\nimport { buildElementModel } from './graph/elements/builder';\nimport classNames from 'classnames';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { color, PreviewPrompt } from '@pie-lib/render-ui';\nimport injectSheet from 'react-jss';\nimport isArray from 'lodash/isArray';\nimport isNumber from 'lodash/isNumber';\nimport isEqual from 'lodash/isEqual';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nexport { Graph };\n\nconst styles = {\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n },\n graphTitle: {\n textAlign: 'center',\n pointerEvents: 'none',\n userSelect: 'none',\n },\n numberLine: {\n boxSizing: 'unset',\n },\n toggle: {\n marginBottom: '16px',\n },\n black_on_rose: {\n backgroundColor: 'mistyrose',\n },\n white_on_black: {\n backgroundColor: 'black',\n '--correct-answer-toggle-label-color': 'white',\n '--tick-color': 'white',\n '--line-stroke': 'white',\n '--arrow-color': 'white',\n '--point-stroke': 'white',\n '--point-fill': 'black',\n },\n prompt: {\n verticalAlign: 'middle',\n marginBottom: '16px',\n },\n};\n\nexport class NumberLine extends React.Component {\n static propTypes = {\n onMoveElement: PropTypes.func.isRequired,\n onDeleteElements: PropTypes.func.isRequired,\n onAddElement: PropTypes.func.isRequired,\n onUndoElement: PropTypes.func.isRequired,\n onClearElements: PropTypes.func.isRequired,\n model: PropTypes.object.isRequired,\n answer: PropTypes.array,\n classes: PropTypes.object.isRequired,\n };\n\n constructor(props, context) {\n super(props, context);\n\n let initialType = props.model.graph ? props.model.graph.initialType : null;\n initialType = initialType ? initialType.toLowerCase() : PointChooser.DEFAULT_TYPE;\n\n this.state = {\n selectedElements: [],\n elementType: initialType,\n answers: props.answer,\n };\n }\n\n toggleElement(index) {\n let selected = [];\n if (this.state.selectedElements.indexOf(index) === -1) {\n selected = this.state.selectedElements.concat([index]);\n } else {\n selected = this.state.selectedElements.filter((e) => e !== index);\n }\n this.setState({ selectedElements: selected });\n }\n\n elementTypeSelected(t) {\n this.setState({ elementType: t });\n }\n\n addElement(x) {\n if (this.hasMaxNoOfPoints()) {\n this.setState({ showMaxPointsWarning: true });\n setTimeout(() => {\n this.setState({ showMaxPointsWarning: false });\n }, 2000);\n return;\n }\n\n const { ticks, domain } = this.props.model.graph;\n\n let elementData = buildElementModel(x, this.state.elementType, domain, ticks.minor);\n\n if (elementData) {\n const { answers } = this.state;\n\n const contains = answers.some((element) => {\n return isEqual(element, elementData);\n });\n\n if (!contains) {\n answers.push(elementData);\n this.setState({ answers });\n this.props.onAddElement(elementData);\n }\n }\n }\n\n hasMaxNoOfPoints() {\n let {\n answer,\n model: {\n graph: { maxNumberOfPoints },\n },\n } = this.props;\n\n return isNumber(maxNumberOfPoints) && maxNumberOfPoints > 0 && (answer || []).length >= maxNumberOfPoints;\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { answer } = nextProps;\n\n if (!isEqual(this.state.answers, answer)) {\n this.setState({ showCorrectAnswer: false, answers: answer });\n }\n }\n\n deselectElements() {\n this.setState({ selectedElements: [] });\n }\n\n getSize(type, min, max, defaultValue) {\n const {\n model: { graph },\n } = this.props;\n\n if (graph && graph[type]) {\n return Math.max(min, Math.min(max, graph[type]));\n } else {\n return defaultValue;\n }\n }\n\n undo() {\n const { answers } = this.state;\n const { onUndoElement } = this.props;\n\n answers.pop();\n this.setState({ answers });\n onUndoElement();\n }\n\n clearAll() {\n const { onClearElements } = this.props;\n\n this.setState({ answers: [] });\n onClearElements();\n }\n\n render() {\n let { model, classes, onDeleteElements, onMoveElement } = this.props;\n let { showCorrectAnswer, answers, selectedElements, showMaxPointsWarning, elementType } = this.state;\n let {\n corrected = { correct: [], incorrect: [] },\n disabled,\n graph,\n correctResponse,\n prompt,\n emptyAnswer,\n feedback,\n colorContrast,\n language\n } = model;\n let addElement = this.addElement.bind(this);\n let elementsSelected = !disabled && selectedElements && selectedElements.length > 0;\n const { ticks, domain, arrows, maxNumberOfPoints, height, availableTypes, title, fraction } = graph;\n const width = this.getSize('width', 400, 1600, 600);\n const graphProps = {\n disabled,\n domain,\n ticks,\n width,\n height: height || 100,\n arrows,\n fraction,\n };\n\n let getAnswerElements = () => {\n return (answers || []).map((e, index) => {\n let out = cloneDeep(e);\n out.selected = selectedElements.indexOf(index) !== -1;\n out.correct = corrected.correct.includes(index)\n ? true\n : corrected.incorrect.includes(index)\n ? false\n : undefined;\n return out;\n });\n };\n\n let getCorrectAnswerElements = () => {\n return (correctResponse || []).map((r) => {\n r.correct = true;\n return r;\n });\n };\n\n let elements = showCorrectAnswer ? getCorrectAnswerElements() : getAnswerElements();\n\n let maxPointsMessage = () => maxNumberOfPoints == 1 ? translator.t('numberLine.addElementLimit_one', {\n lng: language,\n count: 1\n }) : translator.t('numberLine.addElementLimit_other', { lng: language, count: maxNumberOfPoints });\n\n let deleteElements = () => {\n onDeleteElements(selectedElements);\n\n answers = answers.filter((v, index) => {\n return !selectedElements.some((d) => d === index);\n });\n\n this.setState({ selectedElements: [], answers });\n };\n\n let getIcons = () => {\n if (availableTypes) {\n return Object.keys(availableTypes)\n .filter((k) => availableTypes[k])\n .map((k) => k.toLowerCase());\n }\n };\n\n let onShowCorrectAnswer = (show) => {\n this.setState({ showCorrectAnswer: show });\n };\n\n let adjustedWidth = graphProps.width - 20;\n\n const names = classNames(classes.numberLine, classes.mainContainer, classes[colorContrast]);\n\n return (\n <div className={names} style={{ width }}>\n {prompt && (\n <div className={classes.prompt}>\n <PreviewPrompt prompt={prompt} />\n </div>\n )}\n\n <div style={{ width: adjustedWidth }} className={classes.toggle}>\n <Toggle\n show={isArray(correctResponse) && correctResponse.length && !emptyAnswer}\n toggled={showCorrectAnswer}\n onToggle={onShowCorrectAnswer}\n initialValue={false}\n />\n </div>\n\n {!disabled && (\n <PointChooser\n elementType={elementType}\n showDeleteButton={elementsSelected}\n onDeleteClick={deleteElements}\n onElementType={this.elementTypeSelected.bind(this)}\n onClearElements={this.clearAll.bind(this)}\n onUndoElement={this.undo.bind(this)}\n icons={getIcons()}\n language={language}\n />\n )}\n\n <Graph\n {...graphProps}\n elements={elements}\n onAddElement={addElement}\n onMoveElement={onMoveElement}\n onToggleElement={this.toggleElement.bind(this)}\n onDeselectElements={this.deselectElements.bind(this)}\n debug={false}\n />\n {title && <div className={classes.graphTitle} dangerouslySetInnerHTML={{ __html: title }} />}\n\n {showMaxPointsWarning && <Feedback type=\"info\" width={adjustedWidth} message={maxPointsMessage()} />}\n {feedback && !showCorrectAnswer && <Feedback {...feedback} width={adjustedWidth} />}\n </div>\n );\n }\n}\n\nexport default injectSheet(styles)(NumberLine);\n"],"file":"index.js"}
|
|
@@ -31,10 +31,14 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
31
31
|
|
|
32
32
|
var _button = _interopRequireDefault(require("./button"));
|
|
33
33
|
|
|
34
|
+
var _translator = _interopRequireDefault(require("@pie-lib/translator"));
|
|
35
|
+
|
|
34
36
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
35
37
|
|
|
36
38
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
39
|
|
|
40
|
+
var translator = _translator["default"].translator;
|
|
41
|
+
|
|
38
42
|
var DeleteIcon = function DeleteIcon(_ref) {
|
|
39
43
|
var classes = _ref.classes;
|
|
40
44
|
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
@@ -130,7 +134,8 @@ var PointChooser = /*#__PURE__*/function (_React$Component) {
|
|
|
130
134
|
onClearElements = _this$props.onClearElements,
|
|
131
135
|
icons = _this$props.icons,
|
|
132
136
|
classes = _this$props.classes,
|
|
133
|
-
onElementType = _this$props.onElementType
|
|
137
|
+
onElementType = _this$props.onElementType,
|
|
138
|
+
language = _this$props.language;
|
|
134
139
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
135
140
|
className: classes.pointChooser
|
|
136
141
|
}, /*#__PURE__*/_react["default"].createElement(Points, {
|
|
@@ -147,10 +152,14 @@ var PointChooser = /*#__PURE__*/function (_React$Component) {
|
|
|
147
152
|
classes: classes
|
|
148
153
|
})), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
149
154
|
onClick: onUndoElement,
|
|
150
|
-
label:
|
|
155
|
+
label: translator.t('common:undo', {
|
|
156
|
+
lng: language
|
|
157
|
+
})
|
|
151
158
|
}), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
152
159
|
onClick: onClearElements,
|
|
153
|
-
label:
|
|
160
|
+
label: translator.t('numberLine.clearAll', {
|
|
161
|
+
lng: language
|
|
162
|
+
})
|
|
154
163
|
})));
|
|
155
164
|
}
|
|
156
165
|
}]);
|
|
@@ -171,7 +180,8 @@ exports.PointChooser = PointChooser;
|
|
|
171
180
|
onElementType: _propTypes["default"].func.isRequired,
|
|
172
181
|
onUndoElement: _propTypes["default"].func.isRequired,
|
|
173
182
|
onClearElements: _propTypes["default"].func.isRequired,
|
|
174
|
-
icons: _propTypes["default"].array
|
|
183
|
+
icons: _propTypes["default"].array,
|
|
184
|
+
language: _propTypes["default"].string
|
|
175
185
|
});
|
|
176
186
|
|
|
177
187
|
var _default = (0, _reactJss["default"])(_styles["default"])(PointChooser);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/number-line/point-chooser/index.jsx"],"names":["DeleteIcon","classes","deleteIcon","propTypes","PropTypes","object","RawPoint","props","iconKey","active","onClick","names","string","isRequired","bool","func","Point","styles","Points","selectPoint","selected","icons","iconTags","map","key","bind","toLowerCase","elementSelector","array","PointChooser","elementType","showDeleteButton","onDeleteClick","onUndoElement","onClearElements","onElementType","pointChooser","controls","deleteIconHolder","React","Component","DEFAULT_TYPE"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,
|
|
1
|
+
{"version":3,"sources":["../../../src/number-line/point-chooser/index.jsx"],"names":["translator","Translator","DeleteIcon","classes","deleteIcon","propTypes","PropTypes","object","RawPoint","props","iconKey","active","onClick","names","string","isRequired","bool","func","Point","styles","Points","selectPoint","selected","icons","iconTags","map","key","bind","toLowerCase","elementSelector","array","PointChooser","elementType","showDeleteButton","onDeleteClick","onUndoElement","onClearElements","onElementType","language","pointChooser","controls","deleteIconHolder","t","lng","React","Component","DEFAULT_TYPE"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;;AAEA,IAAME,UAAU,GAAG,SAAbA,UAAa,OAAiB;AAAA,MAAdC,OAAc,QAAdA,OAAc;AAClC,sBACE;AACE,IAAA,SAAS,EAAEA,OAAO,CAACC,UADrB;AAEE,IAAA,IAAI,EAAC,SAFP;AAGE,IA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WAAW,EAAE1B,sBAAUQ,MAFN;AAGjBmB,EAAAA,gBAAgB,EAAE3B,sBAAUU,IAHX;AAIjBkB,EAAAA,aAAa,EAAE5B,sBAAUW,IAAV,CAAeF,UAJb;AAKjBsB,EAAAA,aAAa,EAAE/B,sBAAUW,IAAV,CAAeF,UALb;AAMjBoB,EAAAA,aAAa,EAAE7B,sBAAUW,IAAV,CAAeF,UANb;AAOjBqB,EAAAA,eAAe,EAAE9B,sBAAUW,IAAV,CAAeF,UAPf;AAQjBQ,EAAAA,KAAK,EAAEjB,sBAAUwB,KARA;AASjBQ,EAAAA,QAAQ,EAAEhC,sBAAUQ;AATH,C;;eA0CN,0BAAYK,kBAAZ,EAAoBY,YAApB,C;;;AAEfA,YAAY,CAACe,YAAb,GAA4B,IAA5B","sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\nimport injectSheet from 'react-jss';\nimport styles from './styles';\nimport PropTypes from 'prop-types';\nimport Button from './button';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst DeleteIcon = ({ classes }) => {\n return (\n <svg\n className={classes.deleteIcon}\n fill=\"#000000\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z\" />\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n </svg>\n );\n};\n\nDeleteIcon.propTypes = {\n classes: PropTypes.object,\n};\n\nconst RawPoint = (props) => {\n const { iconKey, active, classes, onClick } = props;\n const names = classNames(classes[iconKey], { active });\n return (\n <span role=\"presentation\" key={iconKey} onClick={onClick}>\n <a className={names}> </a>\n </span>\n );\n};\n\nRawPoint.propTypes = {\n iconKey: PropTypes.string.isRequired,\n active: PropTypes.bool,\n classes: PropTypes.object,\n onClick: PropTypes.func,\n};\n\nexport const Point = injectSheet(styles)(RawPoint);\n\nconst Points = ({ selectPoint, classes, selected, icons }) => {\n const iconTags = icons.map((key) => {\n let active = key === selected;\n let onClick = active ? () => {} : selectPoint.bind(null, key);\n return <Point key={key.toLowerCase()} iconKey={key.toLowerCase()} active={active} onClick={onClick} />; //icon(key, active);\n });\n\n return <div className={classes.elementSelector}>{iconTags}</div>;\n};\n\nPoints.propTypes = {\n selectPoint: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n selected: PropTypes.string,\n icons: PropTypes.array,\n};\n\nexport class PointChooser extends React.Component {\n static defaultProps = {\n showDeleteButton: false,\n elementType: PointChooser.DEFAULT_TYPE,\n icons: ['pf', 'lff', 'lef', 'lfe', 'lee', 'rfn', 'rfp', 'ren', 'rep'],\n };\n\n static propTypes = {\n classes: PropTypes.object.isRequired,\n elementType: PropTypes.string,\n showDeleteButton: PropTypes.bool,\n onDeleteClick: PropTypes.func.isRequired,\n onElementType: PropTypes.func.isRequired,\n onUndoElement: PropTypes.func.isRequired,\n onClearElements: PropTypes.func.isRequired,\n icons: PropTypes.array,\n language: PropTypes.string,\n };\n\n render() {\n const {\n elementType,\n showDeleteButton,\n onDeleteClick,\n onUndoElement,\n onClearElements,\n icons,\n classes,\n onElementType,\n language\n } = this.props;\n\n return (\n <div className={classes.pointChooser}>\n <Points selected={elementType} classes={classes} selectPoint={onElementType} icons={icons} />\n <div className={classes.controls}>\n {showDeleteButton && (\n <span className={classes.deleteIconHolder} onClick={onDeleteClick}>\n <DeleteIcon classes={classes} />\n </span>\n )}\n <Button onClick={onUndoElement} label={translator.t('common:undo', { lng: language })} />\n <Button onClick={onClearElements} label={translator.t('numberLine.clearAll', { lng: language })} />\n </div>\n </div>\n );\n }\n}\n\nexport default injectSheet(styles)(PointChooser);\n\nPointChooser.DEFAULT_TYPE = 'pf';\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/number-line",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.13.0",
|
|
4
4
|
"repository": "pie-framework/pie-elements",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
|
-
"@pie-lib/correct-answer-toggle": "^2.3.
|
|
11
|
+
"@pie-lib/correct-answer-toggle": "^2.3.76",
|
|
12
12
|
"@pie-lib/feedback": "^0.4.42",
|
|
13
13
|
"@pie-lib/icons": "^2.4.42",
|
|
14
|
-
"@pie-lib/math-rendering": "^2.5.
|
|
15
|
-
"@pie-lib/render-ui": "^4.14.
|
|
14
|
+
"@pie-lib/math-rendering": "^2.5.15",
|
|
15
|
+
"@pie-lib/render-ui": "^4.14.26",
|
|
16
|
+
"@pie-lib/translator": "^2.0.0",
|
|
16
17
|
"classnames": "^2.2.5",
|
|
17
18
|
"d3-scale": "^3.2.1",
|
|
18
19
|
"d3-selection": "^1.4.1",
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
},
|
|
28
29
|
"author": "pie framework developers",
|
|
29
30
|
"license": "ISC",
|
|
30
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "731f663c04dc7c43e67fe03c2fb18404fa387e04",
|
|
31
32
|
"scripts": {
|
|
32
33
|
"postpublish": "../../scripts/postpublish"
|
|
33
34
|
},
|