@pie-element/fraction-model 4.3.4-next.3 → 5.0.0-beta.1
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 +0 -11
- package/configure/CHANGELOG.md +0 -11
- package/configure/lib/card-bar.js +45 -66
- package/configure/lib/card-bar.js.map +1 -1
- package/configure/lib/defaults.js +4 -5
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +127 -193
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +217 -277
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/model-options.js +119 -196
- package/configure/lib/model-options.js.map +1 -1
- package/configure/lib/number-text-field.js +31 -90
- package/configure/lib/number-text-field.js.map +1 -1
- package/configure/package.json +9 -6
- package/controller/CHANGELOG.md +0 -11
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +66 -111
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +2 -2
- package/lib/answer-fraction.js +94 -159
- package/lib/answer-fraction.js.map +1 -1
- package/lib/fraction-model-chart.js +140 -219
- package/lib/fraction-model-chart.js.map +1 -1
- package/lib/index.js +68 -108
- package/lib/index.js.map +1 -1
- package/lib/main.js +150 -204
- package/lib/main.js.map +1 -1
- package/package.json +14 -17
- package/esm/configure.js +0 -26289
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -1224
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -45827
- package/esm/element.js.map +0 -1
- package/esm/package.json +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["FractionModelConfigure","pieAuthors","document","querySelectorAll","hasPlayerAsParent","Array","from","some","author","contains","_modelCopy","_model","o","dispatchEvent","ModelUpdatedEvent","render","createDefaultModel","_configuration","defaultValues","configuration","m","c","newConfiguration","resetModelAfterConfigurationIsSet","language","enabled","languageChoices","options","length","value","settings","find","option","push","label","handler","InsertImageEvent","src","done","DeleteImageEvent","InsertSoundEvent","DeleteSoundEvent","el","React","createElement","Main","classes","model","onConfigurationChanged","onChange","imageSupport","add","insertImage","bind","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","HTMLElement","normalizedModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAOA;;;;;;;;;;IAEqBA,sB;;;;;AACnB;AACF;AACA;AACA;AACA;AAoBE,oCAAc;AAAA;;AAAA;AACZ;AADY,0HAiDsB,YAAM;AACxC;AACA;AACA;AACA;AACA;AACA,UAAMC,UAAU,GAAGC,QAAQ,CAACC,gBAAT,CAA0B,YAA1B,CAAnB;AACA,YAAKC,iBAAL,GAAyBC,KAAK,CAACC,IAAN,CAAWL,UAAX,EAAuBM,IAAvB,CAA4B,UAACC,MAAD;AAAA,eAAYA,MAAM,CAACC,QAAP,gDAAZ;AAAA,OAA5B,CAAzB;;AAEA,UAAI,MAAKL,iBAAT,EAA4B;AAC1B,YAAI,MAAKM,UAAT,EAAqB;AACnB,gBAAKC,MAAL,GAAc,MAAKD,UAAnB;AACD,SAFD,MAEO;AACL,iBAAO,MAAKA,UAAZ;AACD;AACF;AACF,KAjEa;AAAA,iGA6EH,UAACE,CAAD,EAAO;AAChB,YAAKD,MAAL,mCAAmB,MAAKA,MAAxB,GAAmCC,CAAnC;;AACA,YAAKC,aAAL,CAAmB,IAAIC,qCAAJ,CAAsB,MAAKH,MAA3B,CAAnB;;AACA,YAAKI,MAAL;AACD,KAjFa;AAEZ,UAAKJ,MAAL,GAAcX,sBAAsB,CAACgB,kBAAvB,EAAd;AACA,UAAKC,cAAL,GAAsBC,qBAAcC,aAApC;AAHY;AAIb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKT,MAAL,GAAcX,sBAAsB,CAACgB,kBAAvB,CAA0CI,CAA1C,CAAd;AACA,WAAKL,MAAL;AACD;;;SAED,aAAkBM,CAAlB,EAAqB;AAAA;AAAA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sBAJM;AAKnCC,UAAAA,QAAQ,EAAE,KAAKA,QALoB;AAMnCC,UAAAA,YAAY,EAAE;AACZC,YAAAA,GAAG,EAAE,KAAKC,WAAL,CAAiBC,IAAjB,CAAsB,IAAtB,CADO;AAEZ,sBAAQ,KAAKC,aAAL,CAAmBD,IAAnB,CAAwB,IAAxB;AAFI,WANqB;AAUnCE,UAAAA,kBAAkB,EAAE;AAClBJ,YAAAA,GAAG,EAAE,KAAKK,WAAL,CAAiBH,IAAjB,CAAsB,IAAtB,CADa;AAElB,sBAAQ,KAAKI,aAAL,CAAmBJ,IAAnB,CAAwB,IAAxB;AAFU;AAVe,SAA1B,CAAX;;AAgBAK,6BAAS3C,MAAT,CAAgB2B,EAAhB,EAAoB,IAApB;AACD;AACF;;;kDAzJiDiB,W;;;iCAA/B3D,sB,wBAMS,YAAgB;AAAA,MAAf+C,KAAe,uEAAP,EAAO;AAC1C,MAAM1B,CAAC,GAAGH,qBAAcC,aAAxB;AACA,MAAIK,QAAQ,GAAGuB,KAAK,CAACvB,QAAN,IAAkB,EAAjC;;AAEA,MAAI,CAACA,QAAD,IAAaH,CAAC,CAACG,QAAf,IAA2BH,CAAC,CAACG,QAAF,CAAWC,OAA1C,EAAmD;AAAA;;AACjD,8BAAIJ,CAAC,CAACK,eAAN,wEAAI,mBAAmBC,OAAvB,kDAAI,sBAA4BC,MAAhC,EAAwC;AACtCJ,MAAAA,QAAQ,GAAGH,CAAC,CAACK,eAAF,CAAkBC,OAAlB,CAA0B,CAA1B,EAA6BE,KAAxC;AACD;AACF;;AAED,MAAM+B,eAAe,iDAChB1C,qBAAc6B,KADE,GAEhBA,KAFgB;AAGnBvB,IAAAA,QAAQ,EAARA;AAHmB,IAArB;;AAMA,SAAOoC,eAAP;AACD,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\nimport {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\nimport defaultValues from './defaults';\n\nexport default class FractionModelConfigure extends HTMLElement {\n /**\n * This function makes sure you set the default values on the model\n * @param model\n * @returns model\n */\n static createDefaultModel = (model = {}) => {\n const c = defaultValues.configuration;\n let language = model.language || '';\n\n if (!language && 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 ...defaultValues.model,\n ...model,\n language,\n };\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._model = FractionModelConfigure.createDefaultModel();\n this._configuration = defaultValues.configuration;\n }\n\n set model(m) {\n this._model = FractionModelConfigure.createDefaultModel(m);\n this.render();\n }\n\n set configuration(c) {\n const newConfiguration = {\n ...defaultValues.configuration,\n ...c,\n };\n this._configuration = newConfiguration;\n\n this.resetModelAfterConfigurationIsSet();\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n this.render();\n }\n\n resetModelAfterConfigurationIsSet = () => {\n // In environments that use pie-player-components, model is set before configuration.\n // This is the reason why sometimes the model gets altered non-reversible\n // (altered using default configuration instead of client configuration, because at that point client configuration was not set yet)\n // Therefore, in such environments, we will make sure to keep a modelCopy (initialised in set model) and use it to reset\n // the model in set configuration (resetModelAfterConfigurationIsSet) if set configuration is ever called\n const pieAuthors = document.querySelectorAll('pie-author');\n this.hasPlayerAsParent = Array.from(pieAuthors).some((author) => author.contains(this));\n\n if (this.hasPlayerAsParent) {\n if (this._modelCopy) {\n this._model = this._modelCopy;\n } else {\n delete this._modelCopy;\n }\n }\n };\n\n connectedCallback() {\n this.render();\n }\n\n modelChanged(m) {\n this._model = m;\n this.dispatchEvent(new ModelUpdatedEvent(this._model), true);\n this.render();\n }\n\n onChange = (o) => {\n this._model = { ...this._model, ...o };\n this.dispatchEvent(new ModelUpdatedEvent(this._model));\n this.render();\n };\n\n onConfigurationChanged(c) {\n this._configuration = c;\n this.render();\n }\n\n /**\n *\n * @param {done, progress, file} handler\n */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n render() {\n if (this._model) {\n const el = React.createElement(Main, {\n classes: {},\n model: this._model,\n configuration: this._configuration,\n onConfigurationChanged: this.onConfigurationChanged,\n onChange: this.onChange,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n ReactDOM.render(el, this);\n }\n }\n}\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_main","_pieConfigureEvents","_defaults","FractionModelConfigure","HTMLElement","constructor","_defineProperty2","default","pieAuthors","document","querySelectorAll","hasPlayerAsParent","Array","from","some","author","contains","_modelCopy","_model","o","dispatchEvent","ModelUpdatedEvent","render","_root","createDefaultModel","_configuration","defaultValues","configuration","model","m","c","newConfiguration","resetModelAfterConfigurationIsSet","language","enabled","languageChoices","options","length","value","settings","find","option","push","label","connectedCallback","modelChanged","onConfigurationChanged","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","el","React","createElement","Main","classes","onChange","imageSupport","add","bind","delete","uploadSoundSupport","createRoot","disconnectedCallback","unmount","exports","normalizedModel"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport Main from './main';\nimport {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\nimport defaultValues from './defaults';\n\nexport default class FractionModelConfigure extends HTMLElement {\n /**\n * This function makes sure you set the default values on the model\n * @param model\n * @returns model\n */\n static createDefaultModel = (model = {}) => {\n const c = defaultValues.configuration;\n let language = model.language || '';\n\n if (!language && 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 ...defaultValues.model,\n ...model,\n language,\n };\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._root = null;\n this._model = FractionModelConfigure.createDefaultModel();\n this._configuration = defaultValues.configuration;\n }\n\n set model(m) {\n this._model = FractionModelConfigure.createDefaultModel(m);\n this.render();\n }\n\n set configuration(c) {\n const newConfiguration = {\n ...defaultValues.configuration,\n ...c,\n };\n this._configuration = newConfiguration;\n\n this.resetModelAfterConfigurationIsSet();\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n this.render();\n }\n\n resetModelAfterConfigurationIsSet = () => {\n // In environments that use pie-player-components, model is set before configuration.\n // This is the reason why sometimes the model gets altered non-reversible\n // (altered using default configuration instead of client configuration, because at that point client configuration was not set yet)\n // Therefore, in such environments, we will make sure to keep a modelCopy (initialised in set model) and use it to reset\n // the model in set configuration (resetModelAfterConfigurationIsSet) if set configuration is ever called\n const pieAuthors = document.querySelectorAll('pie-author');\n this.hasPlayerAsParent = Array.from(pieAuthors).some((author) => author.contains(this));\n\n if (this.hasPlayerAsParent) {\n if (this._modelCopy) {\n this._model = this._modelCopy;\n } else {\n delete this._modelCopy;\n }\n }\n };\n\n connectedCallback() {\n this.render();\n }\n\n modelChanged(m) {\n this._model = m;\n this.dispatchEvent(new ModelUpdatedEvent(this._model), true);\n this.render();\n }\n\n onChange = (o) => {\n this._model = { ...this._model, ...o };\n this.dispatchEvent(new ModelUpdatedEvent(this._model));\n this.render();\n };\n\n onConfigurationChanged(c) {\n this._configuration = c;\n this.render();\n }\n\n /**\n *\n * @param {done, progress, file} handler\n */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n render() {\n if (this._model) {\n const el = React.createElement(Main, {\n classes: {},\n model: this._model,\n configuration: this._configuration,\n onConfigurationChanged: this.onConfigurationChanged,\n onChange: this.onChange,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n }\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAOA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEe,MAAMK,sBAAsB,SAASC,WAAW,CAAC;EAyB9DC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,6CAiD0B,MAAM;MACxC;MACA;MACA;MACA;MACA;MACA,MAAMC,UAAU,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,YAAY,CAAC;MAC1D,IAAI,CAACC,iBAAiB,GAAGC,KAAK,CAACC,IAAI,CAACL,UAAU,CAAC,CAACM,IAAI,CAAEC,MAAM,IAAKA,MAAM,CAACC,QAAQ,CAAC,IAAI,CAAC,CAAC;MAEvF,IAAI,IAAI,CAACL,iBAAiB,EAAE;QAC1B,IAAI,IAAI,CAACM,UAAU,EAAE;UACnB,IAAI,CAACC,MAAM,GAAG,IAAI,CAACD,UAAU;QAC/B,CAAC,MAAM;UACL,OAAO,IAAI,CAACA,UAAU;QACxB;MACF;IACF,CAAC;IAAA,IAAAX,gBAAA,CAAAC,OAAA,oBAYWY,CAAC,IAAK;MAChB,IAAI,CAACD,MAAM,GAAG;QAAE,GAAG,IAAI,CAACA,MAAM;QAAE,GAAGC;MAAE,CAAC;MACtC,IAAI,CAACC,aAAa,CAAC,IAAIC,qCAAiB,CAAC,IAAI,CAACH,M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AG,CAAC,CAAC,KAAK;EAC1C,MAAME,CAAC,GAAGJ,iBAAa,CAACC,aAAa;EACrC,IAAIM,QAAQ,GAAGL,KAAK,CAACK,QAAQ,IAAI,EAAE;EAEnC,IAAI,CAACA,QAAQ,IAAIH,CAAC,CAACG,QAAQ,IAAIH,CAAC,CAACG,QAAQ,CAACC,OAAO,EAAE;IACjD,IAAIJ,CAAC,CAACK,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAE;MACtCJ,QAAQ,GAAGH,CAAC,CAACK,eAAe,CAACC,OAAO,CAAC,CAAC,CAAC,CAACE,KAAK;IAC/C;EACF;EAEA,MAAMmC,eAAe,GAAG;IACtB,GAAG/C,iBAAa,CAACE,KAAK;IACtB,GAAGA,KAAK;IACRK;EACF,CAAC;EAED,OAAOwC,eAAe;AACxB,CAAC","ignoreList":[]}
|
package/configure/lib/main.js
CHANGED
|
@@ -1,107 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
7
|
+
exports.default = exports.Main = void 0;
|
|
22
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
9
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
|
-
var _configUi = require("@pie-lib/config-ui");
|
|
27
|
-
|
|
28
|
-
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
29
|
-
|
|
30
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
11
|
+
var _configUi = require("@pie-lib/config-ui");
|
|
12
|
+
var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
|
|
13
|
+
var _fractionModel = require("@pie-element/fraction-model");
|
|
14
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
15
|
+
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
16
|
+
var _styles = require("@mui/material/styles");
|
|
34
17
|
var _cardBar = _interopRequireDefault(require("./card-bar"));
|
|
35
|
-
|
|
36
18
|
var _modelOptions = _interopRequireDefault(require("./model-options"));
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var Main = /*#__PURE__*/function (_React$Component) {
|
|
84
|
-
(0, _inherits2["default"])(Main, _React$Component);
|
|
85
|
-
|
|
86
|
-
var _super = _createSuper(Main);
|
|
87
|
-
|
|
88
|
-
function Main(props) {
|
|
89
|
-
var _this;
|
|
90
|
-
|
|
91
|
-
(0, _classCallCheck2["default"])(this, Main);
|
|
92
|
-
_this = _super.call(this, props);
|
|
93
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onCorrectAnswerChange", function (correctResponse) {
|
|
94
|
-
var _this$props = _this.props,
|
|
95
|
-
model = _this$props.model,
|
|
96
|
-
onChange = _this$props.onChange;
|
|
19
|
+
const StyledFormSection = (0, _styles.styled)(_configUi.FormSection)(({
|
|
20
|
+
theme
|
|
21
|
+
}) => ({
|
|
22
|
+
marginBottom: theme.spacing(4)
|
|
23
|
+
}));
|
|
24
|
+
const StyledTooltip = (0, _styles.styled)(_Tooltip.default)(({
|
|
25
|
+
theme
|
|
26
|
+
}) => ({
|
|
27
|
+
'& .MuiTooltip-tooltip': {
|
|
28
|
+
fontSize: theme.typography.fontSize - 2,
|
|
29
|
+
whiteSpace: 'pre',
|
|
30
|
+
maxWidth: '500px'
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
const ErrorMessage = (0, _styles.styled)('div')(({
|
|
34
|
+
theme
|
|
35
|
+
}) => ({
|
|
36
|
+
fontSize: theme.typography.fontSize - 2,
|
|
37
|
+
color: theme.palette.error.main,
|
|
38
|
+
marginTop: theme.spacing(1)
|
|
39
|
+
}));
|
|
40
|
+
const ModelErrorContainer = (0, _styles.styled)('div')(({
|
|
41
|
+
theme,
|
|
42
|
+
hasError
|
|
43
|
+
}) => ({
|
|
44
|
+
...(hasError && {
|
|
45
|
+
border: `2px solid ${theme.palette.error.main}`
|
|
46
|
+
})
|
|
47
|
+
}));
|
|
48
|
+
const Label = (0, _styles.styled)('label')(({
|
|
49
|
+
theme
|
|
50
|
+
}) => ({
|
|
51
|
+
marginBottom: theme.spacing(4)
|
|
52
|
+
}));
|
|
53
|
+
class Main extends _react.default.Component {
|
|
54
|
+
constructor(props) {
|
|
55
|
+
super(props);
|
|
56
|
+
/*
|
|
57
|
+
* Method to handle correct answer change
|
|
58
|
+
* @param {array} correctResponse - correct response
|
|
59
|
+
* */
|
|
60
|
+
(0, _defineProperty2.default)(this, "onCorrectAnswerChange", correctResponse => {
|
|
61
|
+
const {
|
|
62
|
+
model,
|
|
63
|
+
onChange
|
|
64
|
+
} = this.props;
|
|
97
65
|
model.correctResponse = correctResponse;
|
|
98
|
-
onChange(
|
|
66
|
+
onChange({
|
|
67
|
+
...model
|
|
68
|
+
});
|
|
99
69
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
70
|
+
/*
|
|
71
|
+
* Method to handle model options change
|
|
72
|
+
* @param {object} oldModel - old model
|
|
73
|
+
* @param {object} newModel - new model
|
|
74
|
+
* @param {boolean} showDiag - show dialog or not
|
|
75
|
+
* */
|
|
76
|
+
(0, _defineProperty2.default)(this, "onModelOptionsChange", (oldModel, newModel, showDiag) => {
|
|
77
|
+
const {
|
|
78
|
+
onChange
|
|
79
|
+
} = this.props;
|
|
103
80
|
if (showDiag && oldModel.correctResponse.length > 0) {
|
|
104
|
-
|
|
81
|
+
this.setState({
|
|
105
82
|
correctAnswerChangeDialog: {
|
|
106
83
|
open: true,
|
|
107
84
|
oldModel: oldModel,
|
|
@@ -110,204 +87,167 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
110
87
|
}
|
|
111
88
|
});
|
|
112
89
|
} else {
|
|
113
|
-
onChange(
|
|
90
|
+
onChange({
|
|
91
|
+
...newModel
|
|
92
|
+
});
|
|
114
93
|
}
|
|
115
94
|
});
|
|
116
|
-
|
|
95
|
+
/*
|
|
96
|
+
* Method to generate random key
|
|
97
|
+
* */
|
|
98
|
+
(0, _defineProperty2.default)(this, "generateRandomKey", () => {
|
|
117
99
|
return Math.floor(Math.random() * 10000);
|
|
118
100
|
});
|
|
119
|
-
|
|
101
|
+
this.state = {
|
|
120
102
|
correctAnswerChangeDialog: {
|
|
121
103
|
open: false,
|
|
122
104
|
text: ''
|
|
123
105
|
}
|
|
124
106
|
};
|
|
125
|
-
return _this;
|
|
126
107
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
color: 'primary',
|
|
245
|
-
style: {
|
|
246
|
-
marginLeft: '8px'
|
|
108
|
+
render() {
|
|
109
|
+
const {
|
|
110
|
+
model,
|
|
111
|
+
onChange,
|
|
112
|
+
configuration,
|
|
113
|
+
imageSupport,
|
|
114
|
+
uploadSoundSupport
|
|
115
|
+
} = this.props;
|
|
116
|
+
const {
|
|
117
|
+
baseInputConfiguration = {},
|
|
118
|
+
contentDimensions = {},
|
|
119
|
+
title = {},
|
|
120
|
+
prompt = {},
|
|
121
|
+
modelOptions = {},
|
|
122
|
+
mathMlOptions = {}
|
|
123
|
+
} = configuration || {};
|
|
124
|
+
const {
|
|
125
|
+
errors = {},
|
|
126
|
+
extraCSSRules,
|
|
127
|
+
spellCheckEnabled,
|
|
128
|
+
toolbarEditorPosition
|
|
129
|
+
} = model || {};
|
|
130
|
+
const {
|
|
131
|
+
correctAnswerChangeDialog
|
|
132
|
+
} = this.state;
|
|
133
|
+
const toolbarOpts = {
|
|
134
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
135
|
+
};
|
|
136
|
+
const getPluginProps = (props = {}) => ({
|
|
137
|
+
...baseInputConfiguration,
|
|
138
|
+
...props
|
|
139
|
+
});
|
|
140
|
+
const fractionModelChartKey = this.generateRandomKey();
|
|
141
|
+
return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
142
|
+
extraCSSRules: extraCSSRules,
|
|
143
|
+
dimensions: contentDimensions,
|
|
144
|
+
hideSettings: true
|
|
145
|
+
}, /*#__PURE__*/_react.default.createElement(_cardBar.default, {
|
|
146
|
+
header: "Set Up"
|
|
147
|
+
}), /*#__PURE__*/_react.default.createElement(StyledFormSection, {
|
|
148
|
+
label: title?.label || 'Title'
|
|
149
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
150
|
+
markup: model.title || '',
|
|
151
|
+
onChange: title => onChange({
|
|
152
|
+
title
|
|
153
|
+
}),
|
|
154
|
+
toolbarOpts: toolbarOpts,
|
|
155
|
+
activePlugins: ['bold', 'html', 'italic', 'underline', 'strikethrough', 'image', 'math', 'languageCharacters', 'responseArea'],
|
|
156
|
+
pluginProps: getPluginProps(title?.inputConfiguration),
|
|
157
|
+
spellCheck: spellCheckEnabled,
|
|
158
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
159
|
+
languageCharactersProps: [{
|
|
160
|
+
language: 'spanish'
|
|
161
|
+
}, {
|
|
162
|
+
language: 'special'
|
|
163
|
+
}],
|
|
164
|
+
mathMlOptions: mathMlOptions
|
|
165
|
+
})), /*#__PURE__*/_react.default.createElement(StyledFormSection, {
|
|
166
|
+
label: prompt?.label || 'Question'
|
|
167
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
168
|
+
markup: model.prompt || '',
|
|
169
|
+
minHeight: 60,
|
|
170
|
+
onChange: prompt => onChange({
|
|
171
|
+
prompt
|
|
172
|
+
}),
|
|
173
|
+
toolbarOpts: toolbarOpts,
|
|
174
|
+
pluginProps: getPluginProps(prompt?.inputConfiguration),
|
|
175
|
+
spellCheck: spellCheckEnabled,
|
|
176
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
177
|
+
imageSupport: imageSupport,
|
|
178
|
+
languageCharactersProps: [{
|
|
179
|
+
language: 'spanish'
|
|
180
|
+
}, {
|
|
181
|
+
language: 'special'
|
|
182
|
+
}],
|
|
183
|
+
mathMlOptions: mathMlOptions
|
|
184
|
+
})), /*#__PURE__*/_react.default.createElement(_configUi.FormSection, null, /*#__PURE__*/_react.default.createElement(_modelOptions.default, {
|
|
185
|
+
model: model,
|
|
186
|
+
onChange: this.onModelOptionsChange,
|
|
187
|
+
modelOptions: modelOptions
|
|
188
|
+
})), /*#__PURE__*/_react.default.createElement(_configUi.FormSection, null, " ", /*#__PURE__*/_react.default.createElement(_cardBar.default, {
|
|
189
|
+
header: "Correct Answer",
|
|
190
|
+
info: /*#__PURE__*/_react.default.createElement(StyledTooltip, {
|
|
191
|
+
disableFocusListener: true,
|
|
192
|
+
disableTouchListener: true,
|
|
193
|
+
placement: 'right',
|
|
194
|
+
title: 'The correct answer should include no more than one partially-filled model'
|
|
195
|
+
}, /*#__PURE__*/_react.default.createElement(_Info.default, {
|
|
196
|
+
fontSize: 'small',
|
|
197
|
+
color: 'primary',
|
|
198
|
+
style: {
|
|
199
|
+
marginLeft: '8px'
|
|
200
|
+
}
|
|
201
|
+
}))
|
|
202
|
+
}), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement(Label, null, "Click/touch the number of parts to represent the correct fraction model"), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement(ModelErrorContainer, {
|
|
203
|
+
hasError: !!errors.correctResponse
|
|
204
|
+
}, /*#__PURE__*/_react.default.createElement(_fractionModel.FractionModelChart, {
|
|
205
|
+
key: fractionModelChartKey,
|
|
206
|
+
value: model.correctResponse,
|
|
207
|
+
modelType: model.modelTypeSelected,
|
|
208
|
+
noOfModels: model.maxModelSelected,
|
|
209
|
+
partsPerModel: model.partsPerModel,
|
|
210
|
+
showLabel: model.showGraphLabels,
|
|
211
|
+
onChange: this.onCorrectAnswerChange
|
|
212
|
+
})), errors.correctResponse && /*#__PURE__*/_react.default.createElement(ErrorMessage, null, errors.correctResponse)), /*#__PURE__*/_react.default.createElement(_configUi.AlertDialog, {
|
|
213
|
+
open: correctAnswerChangeDialog.open,
|
|
214
|
+
title: "Warning",
|
|
215
|
+
text: correctAnswerChangeDialog.text,
|
|
216
|
+
onConfirm: () => {
|
|
217
|
+
let newModel = this.state.correctAnswerChangeDialog.newModel;
|
|
218
|
+
newModel.correctResponse = [];
|
|
219
|
+
onChange({
|
|
220
|
+
...newModel
|
|
221
|
+
});
|
|
222
|
+
this.setState({
|
|
223
|
+
correctAnswerChangeDialog: {
|
|
224
|
+
open: false
|
|
247
225
|
}
|
|
248
|
-
})
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
text: correctAnswerChangeDialog.text,
|
|
267
|
-
onConfirm: function onConfirm() {
|
|
268
|
-
var newModel = _this2.state.correctAnswerChangeDialog.newModel;
|
|
269
|
-
newModel.correctResponse = [];
|
|
270
|
-
|
|
271
|
-
_onChange(_objectSpread({}, newModel));
|
|
272
|
-
|
|
273
|
-
_this2.setState({
|
|
274
|
-
correctAnswerChangeDialog: {
|
|
275
|
-
open: false
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
},
|
|
279
|
-
onClose: function onClose() {
|
|
280
|
-
var oldModel = _this2.state.correctAnswerChangeDialog.oldModel;
|
|
281
|
-
|
|
282
|
-
_onChange(_objectSpread({}, oldModel));
|
|
283
|
-
|
|
284
|
-
_this2.setState({
|
|
285
|
-
correctAnswerChangeDialog: {
|
|
286
|
-
open: false
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
},
|
|
290
|
-
onConfirmText: 'OK',
|
|
291
|
-
onCloseText: 'Cancel'
|
|
292
|
-
}));
|
|
293
|
-
}
|
|
294
|
-
}]);
|
|
295
|
-
return Main;
|
|
296
|
-
}(_react["default"].Component);
|
|
297
|
-
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
onClose: () => {
|
|
229
|
+
const oldModel = this.state.correctAnswerChangeDialog.oldModel;
|
|
230
|
+
onChange({
|
|
231
|
+
...oldModel
|
|
232
|
+
});
|
|
233
|
+
this.setState({
|
|
234
|
+
correctAnswerChangeDialog: {
|
|
235
|
+
open: false
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
},
|
|
239
|
+
onConfirmText: 'OK',
|
|
240
|
+
onCloseText: 'Cancel'
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
298
244
|
exports.Main = Main;
|
|
299
|
-
(0, _defineProperty2
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
uploadSoundSupport: _propTypes["default"].object.isRequired
|
|
245
|
+
(0, _defineProperty2.default)(Main, "propTypes", {
|
|
246
|
+
model: _propTypes.default.object.isRequired,
|
|
247
|
+
configuration: _propTypes.default.object.isRequired,
|
|
248
|
+
onConfigurationChanged: _propTypes.default.func.isRequired,
|
|
249
|
+
onChange: _propTypes.default.func.isRequired,
|
|
250
|
+
uploadSoundSupport: _propTypes.default.object.isRequired
|
|
306
251
|
});
|
|
307
|
-
|
|
308
|
-
var _default = (0, _styles.withStyles)(styles, {
|
|
309
|
-
name: 'Main'
|
|
310
|
-
})(Main);
|
|
311
|
-
|
|
312
|
-
exports["default"] = _default;
|
|
252
|
+
var _default = exports.default = Main;
|
|
313
253
|
//# sourceMappingURL=main.js.map
|