@pie-element/ebsr 10.5.2 → 10.5.3-hotfix.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 +11 -0
- package/configure/CHANGELOG.md +11 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +11 -0
- package/controller/package.json +2 -2
- package/lib/print.js +3 -1
- package/lib/print.js.map +1 -1
- package/module/configure.js +3 -3
- package/module/element.js +49 -32
- package/module/index.html +1 -1
- package/module/manifest.json +3 -3
- package/module/print.html +1 -1
- package/module/print.js +50 -32
- package/package.json +4 -4
- package/src/print.js +3 -0
- package/LICENSE.md +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [10.5.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr@10.5.2...@pie-element/ebsr@10.5.3) (2025-04-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update pie-lib/pie-toolbox PD-4967 ([cf4c095](https://github.com/pie-framework/pie-elements/commit/cf4c095f21a2e9bdf74ce5a419ad5fc8d0d7f6ca))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [10.5.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr@10.5.1...@pie-element/ebsr@10.5.2) (2025-04-17)
|
|
7
18
|
|
|
8
19
|
|
package/configure/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
|
+
## [10.4.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-configure@10.4.2...@pie-element/ebsr-configure@10.4.3) (2025-04-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update pie-lib/pie-toolbox PD-4967 ([cf4c095](https://github.com/pie-framework/pie-elements/commit/cf4c095f21a2e9bdf74ce5a419ad5fc8d0d7f6ca))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [10.4.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-configure@10.4.1...@pie-element/ebsr-configure@10.4.2) (2025-04-17)
|
|
7
18
|
|
|
8
19
|
|
package/configure/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "10.4.
|
|
4
|
+
"version": "10.4.3",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
8
8
|
"author": "",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
|
-
"@pie-element/multiple-choice": "^9.15.
|
|
11
|
+
"@pie-element/multiple-choice": "^9.15.3",
|
|
12
12
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
13
|
-
"@pie-lib/pie-toolbox": "2.14.
|
|
13
|
+
"@pie-lib/pie-toolbox": "2.14.3",
|
|
14
14
|
"lodash": "^4.17.15",
|
|
15
15
|
"prop-types": "^15.6.2",
|
|
16
16
|
"react": "^16.8.1",
|
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
|
+
## [8.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-controller@8.2.2...@pie-element/ebsr-controller@8.2.3) (2025-04-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update pie-lib/pie-toolbox PD-4967 ([cf4c095](https://github.com/pie-framework/pie-elements/commit/cf4c095f21a2e9bdf74ce5a419ad5fc8d0d7f6ca))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [8.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-controller@8.2.1...@pie-element/ebsr-controller@8.2.2) (2025-04-17)
|
|
7
18
|
|
|
8
19
|
|
package/controller/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr-controller",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "8.2.
|
|
4
|
+
"version": "8.2.3",
|
|
5
5
|
"description": "",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@pie-lib/pie-toolbox": "2.14.
|
|
10
|
+
"@pie-lib/pie-toolbox": "2.14.3",
|
|
11
11
|
"lodash": "^4.17.15"
|
|
12
12
|
},
|
|
13
13
|
"author": "",
|
package/lib/print.js
CHANGED
|
@@ -196,7 +196,9 @@ var Ebsr = /*#__PURE__*/function (_HTMLElement) {
|
|
|
196
196
|
part.model = _objectSpread(_objectSpread({}, preparePrintModel(this._model[key], this._options)), {}, {
|
|
197
197
|
keyMode: this._model[key].choicePrefix,
|
|
198
198
|
partLabel: labels[key]
|
|
199
|
-
});
|
|
199
|
+
}); // pass options to enable print mode detection in multiple-choice component
|
|
200
|
+
|
|
201
|
+
part.options = this._options;
|
|
200
202
|
|
|
201
203
|
if (!part._session) {
|
|
202
204
|
// for print, "set session" is not called,
|
package/lib/print.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/print.js"],"names":["MC_TAG_NAME","SESSION_CHANGED","SessionChangedEvent","TYPE","translator","Translator","log","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","showTeacherInstructions","alwaysShowCorrect","mode","disabled","animationsDisabled","lockChoiceOrder","choicesLayout","choices","map","c","rationale","rationaleEnabled","hideTick","feedback","keyMode","choicePrefix","EbsrMC","MultipleChoice","defineMultipleChoice","customElements","get","define","isNonEmptyArray","a","Array","isArray","length","isSessionComplete","session","b","Ebsr","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","key","toUpperCase","update","_model","dispatchSessionChanged","srcElement","_session","_options","m","whenDefined","then","setPartModel","partA","partB","s","setPartSession","part","labels","partLabels","language","t","lng","index","partLabelType","partLabel","o","value","partSession","complete","dispatchEvent","tagName","toLowerCase","querySelector","_render","addEventListener","onSessionUpdated","removeEventListener","innerHTML","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAGA;;;;;;;;;;AAFA,IAAMA,WAAW,GAAG,sBAApB;AACA,IAAMC,eAAe,GAAGC,qCAAoBC,IAA5C;AAGA,IAAQC,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;AAEA,IAAME,GAAG,GAAG,uBAAM,wBAAN,CAAZ;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAL,KAAc,YAA5B;AAEAH,EAAAA,KAAK,CAACI,MAAN,GAAeJ,KAAK,CAACK,aAAN,KAAwB,KAAxB,GAAgCL,KAAK,CAACI,MAAtC,GAA+CE,SAA9D;AACAN,EAAAA,KAAK,CAACO,mBAAN,GACEL,KAAK,IAAIF,KAAK,CAACQ,0BAAN,KAAqC,KAA9C,GAAsDR,KAAK,CAACO,mBAA5D,GAAkFD,SADpF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AED,6BAAoB;AAClB,WAAKuF,OAAL;;AACA,WAAKC,gBAAL,CAAsBvF,eAAtB,EAAuC,KAAKwF,gBAA5C;AACD;;;WAED,gCAAuB;AACrB,WAAKC,mBAAL,CAAyBzF,eAAzB,EAA0C,KAAKwF,gBAA/C;AACD;;;WAED,mBAAU;AACR,WAAKE,SAAL,qCAEO3F,WAFP,yBAE+BA,WAF/B,yBAGOA,WAHP,yBAG+BA,WAH/B;AAMD;;;kDAlI+B4F,W","sourcesContent":["import cloneDeep from 'lodash/cloneDeep';\nimport MultipleChoice from '@pie-element/multiple-choice';\nimport debug from 'debug';\nimport get from 'lodash/get';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nconst MC_TAG_NAME = 'ebsr-multiple-choice';\nconst SESSION_CHANGED = SessionChangedEvent.TYPE;\nimport Translator from '@pie-lib/pie-toolbox/translator';\n\nconst { translator } = Translator;\n\nconst log = debug('pie-element:ebsr:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : 'gather';\n\n model.disabled = true;\n model.animationsDisabled = true;\n model.lockChoiceOrder = true;\n model.choicesLayout = model.choicesLayout || 'vertical';\n\n const choices = cloneDeep(model.choices);\n\n model.choices = choices.map((c) => {\n c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;\n c.hideTick = instr;\n c.feedback = undefined;\n return c;\n });\n\n model.keyMode = model.choicePrefix || 'letters';\n\n return model;\n};\n\nclass EbsrMC extends MultipleChoice {}\n\nconst defineMultipleChoice = () => {\n if (!customElements.get(MC_TAG_NAME)) {\n customElements.define(MC_TAG_NAME, EbsrMC);\n }\n};\n\ndefineMultipleChoice();\n\nconst isNonEmptyArray = (a) => Array.isArray(a) && a.length > 0;\n\nexport const isSessionComplete = (session) => {\n const a = get(session, 'value.partA.value');\n const b = get(session, 'value.partB.value');\n\n return isNonEmptyArray(a) && isNonEmptyArray(b);\n};\n\nexport default class Ebsr extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._session = {};\n this._options = null;\n }\n\n onSessionUpdated = (e) => {\n if (e.target === this) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n const id = e.target.getAttribute('id');\n\n if (id) {\n const key = `part${id.toUpperCase()}`;\n\n if (e.update) {\n this._model[key] = e.update;\n }\n //TODO: accessing a private property here. The session event should contain the update in future to prevent this.\n this.dispatchSessionChanged(e.srcElement._session, key);\n }\n };\n\n set model(m) {\n this._model = m;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartModel(this.partA, 'partA');\n this.setPartModel(this.partB, 'partB');\n });\n }\n\n set session(s) {\n this._session = s;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartSession(this.partA, 'partA');\n this.setPartSession(this.partB, 'partB');\n });\n }\n\n setPartModel(part, key) {\n if (this._model && this._model[key] && part) {\n let labels = {\n 'partA': undefined,\n 'partB': undefined\n };\n\n if (this._model.partLabels) {\n const language = this._model.language;\n\n labels = {\n 'partA': translator.t('ebsr.part', {\n lng: language,\n index: this._model.partLabelType === 'Letters' ? 'A' : '1'\n }),\n 'partB': translator.t('ebsr.part', {\n lng: language,\n index: this._model.partLabelType === 'Letters' ? 'B' : '2'\n })\n };\n }\n\n part.model = {\n ...preparePrintModel(this._model[key], this._options),\n keyMode: this._model[key].choicePrefix,\n partLabel: labels[key]\n };\n\n if (!part._session) {\n // for print, \"set session\" is not called,\n // but ebsr needs sessions in order to render the elements,\n // so we set it here it was not set already\n part.session = {};\n }\n }\n }\n\n set options(o) {\n this._options = o;\n }\n\n setPartSession(part, key) {\n if (this._session && this._model && part) {\n const { value } = this._session;\n part.session = value && value[key] ? value[key] : { id: key };\n }\n }\n\n dispatchSessionChanged(partSession, key) {\n this._session.value = {\n ...this._session.value,\n [key]: partSession,\n };\n\n log('[onSessionChanged] session: ', this._session);\n const complete = isSessionComplete(this._session);\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), complete));\n }\n\n get partA() {\n return this.querySelector(`${MC_TAG_NAME}#a`);\n }\n\n get partB() {\n return this.querySelector(`${MC_TAG_NAME}#b`);\n }\n\n connectedCallback() {\n this._render();\n this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n disconnectedCallback() {\n this.removeEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n _render() {\n this.innerHTML = `\n <div>\n <${MC_TAG_NAME} id=\"a\"></${MC_TAG_NAME}>\n <${MC_TAG_NAME} id=\"b\"></${MC_TAG_NAME}>\n </div>\n `;\n }\n}\n"],"file":"print.js"}
|
|
1
|
+
{"version":3,"sources":["../src/print.js"],"names":["MC_TAG_NAME","SESSION_CHANGED","SessionChangedEvent","TYPE","translator","Translator","log","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","showTeacherInstructions","alwaysShowCorrect","mode","disabled","animationsDisabled","lockChoiceOrder","choicesLayout","choices","map","c","rationale","rationaleEnabled","hideTick","feedback","keyMode","choicePrefix","EbsrMC","MultipleChoice","defineMultipleChoice","customElements","get","define","isNonEmptyArray","a","Array","isArray","length","isSessionComplete","session","b","Ebsr","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","key","toUpperCase","update","_model","dispatchSessionChanged","srcElement","_session","_options","m","whenDefined","then","setPartModel","partA","partB","s","setPartSession","part","labels","partLabels","language","t","lng","index","partLabelType","partLabel","options","o","value","partSession","complete","dispatchEvent","tagName","toLowerCase","querySelector","_render","addEventListener","onSessionUpdated","removeEventListener","innerHTML","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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B,KAAR;AACAX,QAAAA,IAAI,CAACzB,OAAL,GAAeoC,KAAK,IAAIA,KAAK,CAAC3B,GAAD,CAAd,GAAsB2B,KAAK,CAAC3B,GAAD,CAA3B,GAAmC;AAAEF,UAAAA,EAAE,EAAEE;AAAN,SAAlD;AACD;AACF;;;WAED,gCAAuB4B,WAAvB,EAAoC5B,GAApC,EAAyC;AACvC,WAAKM,QAAL,CAAcqB,KAAd,mCACK,KAAKrB,QAAL,CAAcqB,KADnB,4CAEG3B,GAFH,EAES4B,WAFT;AAKA5E,MAAAA,GAAG,CAAC,8BAAD,EAAiC,KAAKsD,QAAtC,CAAH;AACA,UAAMuB,QAAQ,GAAGvC,iBAAiB,CAAC,KAAKgB,QAAN,CAAlC;AACA,WAAKwB,aAAL,CAAmB,IAAIlF,oCAAJ,CAAwB,KAAKmF,OAAL,CAAaC,WAAb,EAAxB,EAAoDH,QAApD,CAAnB;AACD;;;SAED,eAAY;AACV,aAAO,KAAKI,aAAL,WAAsBvF,WAAtB,QAAP;AACD;;;SAED,eAAY;AACV,aAAO,KAAKuF,aAAL,WAAsBvF,WAAtB,QAAP;AACD;;;WAED,6BAAoB;AAClB,WAAKwF,OAAL;;AACA,WAAKC,gBAAL,CAAsBxF,eAAtB,EAAuC,KAAKyF,gBAA5C;AACD;;;WAED,gCAAuB;AACrB,WAAKC,mBAAL,CAAyB1F,eAAzB,EAA0C,KAAKyF,gBAA/C;AACD;;;WAED,mBAAU;AACR,WAAKE,SAAL,qCAEO5F,WAFP,yBAE+BA,WAF/B,yBAGOA,WAHP,yBAG+BA,WAH/B;AAMD;;;kDArI+B6F,W","sourcesContent":["import cloneDeep from 'lodash/cloneDeep';\nimport MultipleChoice from '@pie-element/multiple-choice';\nimport debug from 'debug';\nimport get from 'lodash/get';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nconst MC_TAG_NAME = 'ebsr-multiple-choice';\nconst SESSION_CHANGED = SessionChangedEvent.TYPE;\nimport Translator from '@pie-lib/pie-toolbox/translator';\n\nconst { translator } = Translator;\n\nconst log = debug('pie-element:ebsr:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : 'gather';\n\n model.disabled = true;\n model.animationsDisabled = true;\n model.lockChoiceOrder = true;\n model.choicesLayout = model.choicesLayout || 'vertical';\n\n const choices = cloneDeep(model.choices);\n\n model.choices = choices.map((c) => {\n c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;\n c.hideTick = instr;\n c.feedback = undefined;\n return c;\n });\n\n model.keyMode = model.choicePrefix || 'letters';\n\n return model;\n};\n\nclass EbsrMC extends MultipleChoice {}\n\nconst defineMultipleChoice = () => {\n if (!customElements.get(MC_TAG_NAME)) {\n customElements.define(MC_TAG_NAME, EbsrMC);\n }\n};\n\ndefineMultipleChoice();\n\nconst isNonEmptyArray = (a) => Array.isArray(a) && a.length > 0;\n\nexport const isSessionComplete = (session) => {\n const a = get(session, 'value.partA.value');\n const b = get(session, 'value.partB.value');\n\n return isNonEmptyArray(a) && isNonEmptyArray(b);\n};\n\nexport default class Ebsr extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._session = {};\n this._options = null;\n }\n\n onSessionUpdated = (e) => {\n if (e.target === this) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n const id = e.target.getAttribute('id');\n\n if (id) {\n const key = `part${id.toUpperCase()}`;\n\n if (e.update) {\n this._model[key] = e.update;\n }\n //TODO: accessing a private property here. The session event should contain the update in future to prevent this.\n this.dispatchSessionChanged(e.srcElement._session, key);\n }\n };\n\n set model(m) {\n this._model = m;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartModel(this.partA, 'partA');\n this.setPartModel(this.partB, 'partB');\n });\n }\n\n set session(s) {\n this._session = s;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartSession(this.partA, 'partA');\n this.setPartSession(this.partB, 'partB');\n });\n }\n\n setPartModel(part, key) {\n if (this._model && this._model[key] && part) {\n let labels = {\n 'partA': undefined,\n 'partB': undefined\n };\n\n if (this._model.partLabels) {\n const language = this._model.language;\n\n labels = {\n 'partA': translator.t('ebsr.part', {\n lng: language,\n index: this._model.partLabelType === 'Letters' ? 'A' : '1'\n }),\n 'partB': translator.t('ebsr.part', {\n lng: language,\n index: this._model.partLabelType === 'Letters' ? 'B' : '2'\n })\n };\n }\n\n part.model = {\n ...preparePrintModel(this._model[key], this._options),\n keyMode: this._model[key].choicePrefix,\n partLabel: labels[key]\n };\n\n // pass options to enable print mode detection in multiple-choice component\n part.options = this._options;\n\n if (!part._session) {\n // for print, \"set session\" is not called,\n // but ebsr needs sessions in order to render the elements,\n // so we set it here it was not set already\n part.session = {};\n }\n }\n }\n\n set options(o) {\n this._options = o;\n }\n\n setPartSession(part, key) {\n if (this._session && this._model && part) {\n const { value } = this._session;\n part.session = value && value[key] ? value[key] : { id: key };\n }\n }\n\n dispatchSessionChanged(partSession, key) {\n this._session.value = {\n ...this._session.value,\n [key]: partSession,\n };\n\n log('[onSessionChanged] session: ', this._session);\n const complete = isSessionComplete(this._session);\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), complete));\n }\n\n get partA() {\n return this.querySelector(`${MC_TAG_NAME}#a`);\n }\n\n get partB() {\n return this.querySelector(`${MC_TAG_NAME}#b`);\n }\n\n connectedCallback() {\n this._render();\n this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n disconnectedCallback() {\n this.removeEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n _render() {\n this.innerHTML = `\n <div>\n <${MC_TAG_NAME} id=\"a\"></${MC_TAG_NAME}>\n <${MC_TAG_NAME} id=\"b\"></${MC_TAG_NAME}>\n </div>\n `;\n }\n}\n"],"file":"print.js"}
|
package/module/configure.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_lodash, _dll_react_dom} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_lodash, _dll_react_dom} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.9.0/module/index.js";
|
|
2
2
|
import MultipleChoiceConfigure from '@pie-element/multiple-choice/configure/lib';
|
|
3
|
-
import {_dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@6.0.
|
|
3
|
+
import {_dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@6.0.3/module/index.js";
|
|
4
4
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
5
5
|
function getDefaultExportFromCjs(x) {
|
|
6
6
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -5499,7 +5499,7 @@ const React$1 = _dll_react;
|
|
|
5499
5499
|
const PropTypes = _dll_prop_types;
|
|
5500
5500
|
const {settings: settings} = _dll_pie_lib__pie_toolbox_config_ui;
|
|
5501
5501
|
const {layout: layout} = _dll_pie_lib__pie_toolbox_config_ui;
|
|
5502
|
-
const _jsxFileName = "/
|
|
5502
|
+
const _jsxFileName = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/ebsr/configure/src/main.jsx";
|
|
5503
5503
|
const {Panel, toggle, radio, dropdown} = settings;
|
|
5504
5504
|
const styles = theme => ({
|
|
5505
5505
|
partLabel: {
|
package/module/element.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.
|
|
2
|
-
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@6.0.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.9.0/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@6.0.3/module/index.js";
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
function getDefaultExportFromCjs(x) {
|
|
5
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -11991,7 +11991,7 @@ var reactTransitionGroup = {
|
|
|
11991
11991
|
const React$5 = _dll_react;
|
|
11992
11992
|
const PropTypes$4 = _dll_prop_types;
|
|
11993
11993
|
const {color: color$2} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
11994
|
-
const _jsxFileName$4 = "/
|
|
11994
|
+
const _jsxFileName$4 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/feedback-tick.jsx";
|
|
11995
11995
|
const stylesheet = {
|
|
11996
11996
|
incorrect: {
|
|
11997
11997
|
fill: `var(--feedback-incorrect-bg-color, ${color$2.incorrect()})`
|
|
@@ -12162,7 +12162,7 @@ const classNames$2 = _dll_classnames;
|
|
|
12162
12162
|
const {Feedback: Feedback} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12163
12163
|
const {color: color$1} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12164
12164
|
const {PreviewPrompt: PreviewPrompt$1} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12165
|
-
const _jsxFileName$3 = "/
|
|
12165
|
+
const _jsxFileName$3 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/choice-input.jsx";
|
|
12166
12166
|
const CLASS_NAME = 'multiple-choice-component';
|
|
12167
12167
|
const styleSheet = theme => ({
|
|
12168
12168
|
row: {
|
|
@@ -12516,7 +12516,7 @@ var ChoiceInput$1 = styles$b.withStyles(styleSheet)(ChoiceInput);
|
|
|
12516
12516
|
const React$3 = _dll_react;
|
|
12517
12517
|
const PropTypes$2 = _dll_prop_types;
|
|
12518
12518
|
const classNames$1 = _dll_classnames;
|
|
12519
|
-
const _jsxFileName$2 = "/
|
|
12519
|
+
const _jsxFileName$2 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/choice.jsx";
|
|
12520
12520
|
class Choice extends React$3.Component {
|
|
12521
12521
|
constructor(...args) {
|
|
12522
12522
|
super(...args);
|
|
@@ -12623,7 +12623,7 @@ const {CorrectAnswerToggle: CorrectAnswerToggle} = _dll_pie_lib__pie_toolbox_cor
|
|
|
12623
12623
|
const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12624
12624
|
const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12625
12625
|
const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12626
|
-
const _jsxFileName$1 = "/
|
|
12626
|
+
const _jsxFileName$1 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/multiple-choice.jsx";
|
|
12627
12627
|
const {translator} = Translator;
|
|
12628
12628
|
const styles$1 = theme => ({
|
|
12629
12629
|
main: {
|
|
@@ -12703,7 +12703,8 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12703
12703
|
customAudioButton: {
|
|
12704
12704
|
playImage: PropTypes$1.string,
|
|
12705
12705
|
pauseImage: PropTypes$1.string
|
|
12706
|
-
}
|
|
12706
|
+
},
|
|
12707
|
+
options: PropTypes$1.object
|
|
12707
12708
|
};
|
|
12708
12709
|
}
|
|
12709
12710
|
constructor(props) {
|
|
@@ -12712,7 +12713,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12712
12713
|
MultipleChoice$1.prototype.__init2.call(this);
|
|
12713
12714
|
MultipleChoice$1.prototype.__init3.call(this);
|
|
12714
12715
|
this.state = {
|
|
12715
|
-
showCorrect: this.props.alwaysShowCorrect || false,
|
|
12716
|
+
showCorrect: this.props.options && this.props.alwaysShowCorrect || false,
|
|
12716
12717
|
maxSelectionsErrorState: false
|
|
12717
12718
|
};
|
|
12718
12719
|
this.onToggle = this.onToggle.bind(this);
|
|
@@ -12763,7 +12764,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12763
12764
|
}
|
|
12764
12765
|
});
|
|
12765
12766
|
}
|
|
12766
|
-
if (nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {
|
|
12767
|
+
if (nextProps.options && nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {
|
|
12767
12768
|
this.setState({
|
|
12768
12769
|
showCorrect: true
|
|
12769
12770
|
}, () => {
|
|
@@ -12805,7 +12806,12 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12805
12806
|
};
|
|
12806
12807
|
}
|
|
12807
12808
|
getChecked(choice) {
|
|
12808
|
-
|
|
12809
|
+
const isPrintMode = this.props.options && this.props.alwaysShowCorrect;
|
|
12810
|
+
if (isPrintMode) {
|
|
12811
|
+
return choice.correct || false;
|
|
12812
|
+
}
|
|
12813
|
+
const isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';
|
|
12814
|
+
if (isEvaluateMode) {
|
|
12809
12815
|
return choice.correct || false;
|
|
12810
12816
|
}
|
|
12811
12817
|
return this.isSelected(choice.value);
|
|
@@ -12820,19 +12826,19 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12820
12826
|
__self: this,
|
|
12821
12827
|
__source: {
|
|
12822
12828
|
fileName: _jsxFileName$1,
|
|
12823
|
-
lineNumber:
|
|
12829
|
+
lineNumber: 227
|
|
12824
12830
|
}
|
|
12825
12831
|
}, "Multiple Choice Question") : React$2.createElement('h2', {
|
|
12826
12832
|
className: classes.srOnly,
|
|
12827
12833
|
__self: this,
|
|
12828
12834
|
__source: {
|
|
12829
12835
|
fileName: _jsxFileName$1,
|
|
12830
|
-
lineNumber:
|
|
12836
|
+
lineNumber: 229
|
|
12831
12837
|
}
|
|
12832
12838
|
}, "Multiple Select Question");
|
|
12833
12839
|
}
|
|
12834
12840
|
render() {
|
|
12835
|
-
const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt, responseCorrect, teacherInstructions, classes, alwaysShowCorrect, animationsDisabled, language, isSelectionButtonBelow, minSelections, maxSelections, autoplayAudioEnabled, session, customAudioButton} = this.props;
|
|
12841
|
+
const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt, responseCorrect, teacherInstructions, classes, alwaysShowCorrect, animationsDisabled, language, isSelectionButtonBelow, minSelections, maxSelections, autoplayAudioEnabled, session, customAudioButton, options} = this.props;
|
|
12836
12842
|
const {showCorrect, maxSelectionsErrorState} = this.state;
|
|
12837
12843
|
const isEvaluateMode = mode === 'evaluate';
|
|
12838
12844
|
const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
|
|
@@ -12848,7 +12854,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12848
12854
|
__self: this,
|
|
12849
12855
|
__source: {
|
|
12850
12856
|
fileName: _jsxFileName$1,
|
|
12851
|
-
lineNumber:
|
|
12857
|
+
lineNumber: 264
|
|
12852
12858
|
}
|
|
12853
12859
|
});
|
|
12854
12860
|
const getMultipleChoiceMinSelectionErrorMessage = () => {
|
|
@@ -12876,21 +12882,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12876
12882
|
__self: this,
|
|
12877
12883
|
__source: {
|
|
12878
12884
|
fileName: _jsxFileName$1,
|
|
12879
|
-
lineNumber:
|
|
12885
|
+
lineNumber: 287
|
|
12880
12886
|
}
|
|
12881
12887
|
}, partLabel && React$2.createElement('h3', {
|
|
12882
12888
|
className: classes.partLabel,
|
|
12883
12889
|
__self: this,
|
|
12884
12890
|
__source: {
|
|
12885
12891
|
fileName: _jsxFileName$1,
|
|
12886
|
-
lineNumber:
|
|
12892
|
+
lineNumber: 288
|
|
12887
12893
|
}
|
|
12888
12894
|
}, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
|
|
12889
12895
|
className: classes.teacherInstructions,
|
|
12890
12896
|
__self: this,
|
|
12891
12897
|
__source: {
|
|
12892
12898
|
fileName: _jsxFileName$1,
|
|
12893
|
-
lineNumber:
|
|
12899
|
+
lineNumber: 293
|
|
12894
12900
|
}
|
|
12895
12901
|
}, !animationsDisabled ? React$2.createElement(Collapsible, {
|
|
12896
12902
|
labels: {
|
|
@@ -12900,14 +12906,14 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12900
12906
|
__self: this,
|
|
12901
12907
|
__source: {
|
|
12902
12908
|
fileName: _jsxFileName$1,
|
|
12903
|
-
lineNumber:
|
|
12909
|
+
lineNumber: 295
|
|
12904
12910
|
}
|
|
12905
12911
|
}, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
|
|
12906
12912
|
className: classes.fieldset,
|
|
12907
12913
|
__self: this,
|
|
12908
12914
|
__source: {
|
|
12909
12915
|
fileName: _jsxFileName$1,
|
|
12910
|
-
lineNumber:
|
|
12916
|
+
lineNumber: 309
|
|
12911
12917
|
}
|
|
12912
12918
|
}, React$2.createElement(PreviewPrompt, {
|
|
12913
12919
|
className: "prompt",
|
|
@@ -12919,9 +12925,9 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12919
12925
|
__self: this,
|
|
12920
12926
|
__source: {
|
|
12921
12927
|
fileName: _jsxFileName$1,
|
|
12922
|
-
lineNumber:
|
|
12928
|
+
lineNumber: 310
|
|
12923
12929
|
}
|
|
12924
|
-
}), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
|
|
12930
|
+
}), !(options && alwaysShowCorrect) && React$2.createElement(CorrectAnswerToggle, {
|
|
12925
12931
|
show: showCorrectAnswerToggle,
|
|
12926
12932
|
toggled: showCorrect,
|
|
12927
12933
|
onToggle: this.onToggle.bind(this),
|
|
@@ -12929,7 +12935,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12929
12935
|
__self: this,
|
|
12930
12936
|
__source: {
|
|
12931
12937
|
fileName: _jsxFileName$1,
|
|
12932
|
-
lineNumber:
|
|
12938
|
+
lineNumber: 320
|
|
12933
12939
|
}
|
|
12934
12940
|
}), React$2.createElement('div', {
|
|
12935
12941
|
className: classNames({
|
|
@@ -12940,7 +12946,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12940
12946
|
__self: this,
|
|
12941
12947
|
__source: {
|
|
12942
12948
|
fileName: _jsxFileName$1,
|
|
12943
|
-
lineNumber:
|
|
12949
|
+
lineNumber: 328
|
|
12944
12950
|
}
|
|
12945
12951
|
}, choices.map((choice, index) => React$2.createElement(StyledChoice, {
|
|
12946
12952
|
choicesLayout: this.props.choicesLayout,
|
|
@@ -12963,21 +12969,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12963
12969
|
__self: this,
|
|
12964
12970
|
__source: {
|
|
12965
12971
|
fileName: _jsxFileName$1,
|
|
12966
|
-
lineNumber:
|
|
12972
|
+
lineNumber: 336
|
|
12967
12973
|
}
|
|
12968
12974
|
})))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
|
|
12969
12975
|
className: classes.errorText,
|
|
12970
12976
|
__self: this,
|
|
12971
12977
|
__source: {
|
|
12972
12978
|
fileName: _jsxFileName$1,
|
|
12973
|
-
lineNumber:
|
|
12979
|
+
lineNumber: 360
|
|
12974
12980
|
}
|
|
12975
12981
|
}, getMultipleChoiceMinSelectionErrorMessage()), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
|
|
12976
12982
|
className: classes.errorText,
|
|
12977
12983
|
__self: this,
|
|
12978
12984
|
__source: {
|
|
12979
12985
|
fileName: _jsxFileName$1,
|
|
12980
|
-
lineNumber:
|
|
12986
|
+
lineNumber: 365
|
|
12981
12987
|
}
|
|
12982
12988
|
}, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
|
|
12983
12989
|
lng: language,
|
|
@@ -12995,13 +13001,14 @@ var MultipleChoice$2 = styles$b.withStyles(styles$1)(MultipleChoice$1);
|
|
|
12995
13001
|
const React$1 = _dll_react;
|
|
12996
13002
|
const PropTypes = _dll_prop_types;
|
|
12997
13003
|
const {PreviewLayout: PreviewLayout} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12998
|
-
const _jsxFileName = "/
|
|
13004
|
+
const _jsxFileName = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/main.jsx";
|
|
12999
13005
|
const styles = () => ({});
|
|
13000
13006
|
class Main extends React$1.Component {
|
|
13001
13007
|
static __initStatic() {
|
|
13002
13008
|
this.propTypes = {
|
|
13003
13009
|
model: PropTypes.object,
|
|
13004
13010
|
session: PropTypes.object,
|
|
13011
|
+
options: PropTypes.object,
|
|
13005
13012
|
onChoiceChanged: PropTypes.func,
|
|
13006
13013
|
classes: PropTypes.object.isRequired,
|
|
13007
13014
|
onShowCorrectToggle: PropTypes.func,
|
|
@@ -13021,7 +13028,7 @@ class Main extends React$1.Component {
|
|
|
13021
13028
|
super(props);
|
|
13022
13029
|
}
|
|
13023
13030
|
render() {
|
|
13024
|
-
const {model, onChoiceChanged, session, onShowCorrectToggle} = this.props;
|
|
13031
|
+
const {model, onChoiceChanged, session, onShowCorrectToggle, options} = this.props;
|
|
13025
13032
|
const {extraCSSRules, fontSizeFactor} = model;
|
|
13026
13033
|
return React$1.createElement(PreviewLayout, {
|
|
13027
13034
|
extraCSSRules: extraCSSRules,
|
|
@@ -13029,17 +13036,18 @@ class Main extends React$1.Component {
|
|
|
13029
13036
|
__self: this,
|
|
13030
13037
|
__source: {
|
|
13031
13038
|
fileName: _jsxFileName,
|
|
13032
|
-
lineNumber:
|
|
13039
|
+
lineNumber: 38
|
|
13033
13040
|
}
|
|
13034
13041
|
}, React$1.createElement(MultipleChoice$2, {
|
|
13035
13042
|
...model,
|
|
13043
|
+
options: options,
|
|
13036
13044
|
session: session,
|
|
13037
13045
|
onChoiceChanged: onChoiceChanged,
|
|
13038
13046
|
onShowCorrectToggle: onShowCorrectToggle,
|
|
13039
13047
|
__self: this,
|
|
13040
13048
|
__source: {
|
|
13041
13049
|
fileName: _jsxFileName,
|
|
13042
|
-
lineNumber:
|
|
13050
|
+
lineNumber: 39
|
|
13043
13051
|
}
|
|
13044
13052
|
}));
|
|
13045
13053
|
}
|
|
@@ -13059,14 +13067,14 @@ const Root = props => React$1.createElement(styles$b.MuiThemeProvider, {
|
|
|
13059
13067
|
__self: undefined,
|
|
13060
13068
|
__source: {
|
|
13061
13069
|
fileName: _jsxFileName,
|
|
13062
|
-
lineNumber:
|
|
13070
|
+
lineNumber: 60
|
|
13063
13071
|
}
|
|
13064
13072
|
}, React$1.createElement(Styled, {
|
|
13065
13073
|
...props,
|
|
13066
13074
|
__self: undefined,
|
|
13067
13075
|
__source: {
|
|
13068
13076
|
fileName: _jsxFileName,
|
|
13069
|
-
lineNumber:
|
|
13077
|
+
lineNumber: 61
|
|
13070
13078
|
}
|
|
13071
13079
|
}));
|
|
13072
13080
|
const {concat: concat} = _dll_lodash;
|
|
@@ -13148,6 +13156,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
13148
13156
|
super();
|
|
13149
13157
|
this._model = null;
|
|
13150
13158
|
this._session = null;
|
|
13159
|
+
this._options = null;
|
|
13151
13160
|
this.audioComplete = false;
|
|
13152
13161
|
this._boundHandleKeyDown = this.handleKeyDown.bind(this);
|
|
13153
13162
|
this._keyboardEventsEnabled = false;
|
|
@@ -13156,6 +13165,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
13156
13165
|
var element = React.createElement(Root, {
|
|
13157
13166
|
model: this._model,
|
|
13158
13167
|
session: this._session,
|
|
13168
|
+
options: this._options,
|
|
13159
13169
|
onChoiceChanged: this._onChange.bind(this),
|
|
13160
13170
|
onShowCorrectToggle: this.onShowCorrectToggle.bind(this)
|
|
13161
13171
|
});
|
|
@@ -13202,6 +13212,13 @@ class MultipleChoice extends HTMLElement {
|
|
|
13202
13212
|
get session() {
|
|
13203
13213
|
return this._session;
|
|
13204
13214
|
}
|
|
13215
|
+
get options() {
|
|
13216
|
+
return this._options;
|
|
13217
|
+
}
|
|
13218
|
+
set options(o) {
|
|
13219
|
+
this._options = o;
|
|
13220
|
+
this._rerender();
|
|
13221
|
+
}
|
|
13205
13222
|
set session(s) {
|
|
13206
13223
|
this._session = s;
|
|
13207
13224
|
this._rerender();
|
package/module/index.html
CHANGED
package/module/manifest.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr",
|
|
3
|
-
"version": "10.5.
|
|
3
|
+
"version": "10.5.3",
|
|
4
4
|
"modules": [
|
|
5
5
|
{
|
|
6
6
|
"name": "@pie-lib/pie-toolbox-math-rendering-module",
|
|
7
|
-
"version": "3.
|
|
7
|
+
"version": "3.9.0"
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"name": "@pie-lib/pie-toolbox-module",
|
|
11
|
-
"version": "6.0.
|
|
11
|
+
"version": "6.0.3"
|
|
12
12
|
}
|
|
13
13
|
]
|
|
14
14
|
}
|
package/module/print.html
CHANGED
package/module/print.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.
|
|
2
|
-
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@6.0.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.9.0/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@6.0.3/module/index.js";
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
function getDefaultExportFromCjs(x) {
|
|
5
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -11954,7 +11954,7 @@ var reactTransitionGroup = {
|
|
|
11954
11954
|
const React$5 = _dll_react;
|
|
11955
11955
|
const PropTypes$4 = _dll_prop_types;
|
|
11956
11956
|
const {color: color$2} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
11957
|
-
const _jsxFileName$4 = "/
|
|
11957
|
+
const _jsxFileName$4 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/feedback-tick.jsx";
|
|
11958
11958
|
const stylesheet = {
|
|
11959
11959
|
incorrect: {
|
|
11960
11960
|
fill: `var(--feedback-incorrect-bg-color, ${color$2.incorrect()})`
|
|
@@ -12125,7 +12125,7 @@ const classNames$2 = _dll_classnames;
|
|
|
12125
12125
|
const {Feedback: Feedback} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12126
12126
|
const {color: color$1} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12127
12127
|
const {PreviewPrompt: PreviewPrompt$1} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12128
|
-
const _jsxFileName$3 = "/
|
|
12128
|
+
const _jsxFileName$3 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/choice-input.jsx";
|
|
12129
12129
|
const CLASS_NAME = 'multiple-choice-component';
|
|
12130
12130
|
const styleSheet = theme => ({
|
|
12131
12131
|
row: {
|
|
@@ -12479,7 +12479,7 @@ var ChoiceInput$1 = styles$b.withStyles(styleSheet)(ChoiceInput);
|
|
|
12479
12479
|
const React$3 = _dll_react;
|
|
12480
12480
|
const PropTypes$2 = _dll_prop_types;
|
|
12481
12481
|
const classNames$1 = _dll_classnames;
|
|
12482
|
-
const _jsxFileName$2 = "/
|
|
12482
|
+
const _jsxFileName$2 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/choice.jsx";
|
|
12483
12483
|
class Choice extends React$3.Component {
|
|
12484
12484
|
constructor(...args) {
|
|
12485
12485
|
super(...args);
|
|
@@ -12586,7 +12586,7 @@ const {CorrectAnswerToggle: CorrectAnswerToggle} = _dll_pie_lib__pie_toolbox_cor
|
|
|
12586
12586
|
const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12587
12587
|
const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12588
12588
|
const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12589
|
-
const _jsxFileName$1 = "/
|
|
12589
|
+
const _jsxFileName$1 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/multiple-choice.jsx";
|
|
12590
12590
|
const {translator: translator$1} = Translator;
|
|
12591
12591
|
const styles$1 = theme => ({
|
|
12592
12592
|
main: {
|
|
@@ -12666,7 +12666,8 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12666
12666
|
customAudioButton: {
|
|
12667
12667
|
playImage: PropTypes$1.string,
|
|
12668
12668
|
pauseImage: PropTypes$1.string
|
|
12669
|
-
}
|
|
12669
|
+
},
|
|
12670
|
+
options: PropTypes$1.object
|
|
12670
12671
|
};
|
|
12671
12672
|
}
|
|
12672
12673
|
constructor(props) {
|
|
@@ -12675,7 +12676,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12675
12676
|
MultipleChoice$1.prototype.__init2.call(this);
|
|
12676
12677
|
MultipleChoice$1.prototype.__init3.call(this);
|
|
12677
12678
|
this.state = {
|
|
12678
|
-
showCorrect: this.props.alwaysShowCorrect || false,
|
|
12679
|
+
showCorrect: this.props.options && this.props.alwaysShowCorrect || false,
|
|
12679
12680
|
maxSelectionsErrorState: false
|
|
12680
12681
|
};
|
|
12681
12682
|
this.onToggle = this.onToggle.bind(this);
|
|
@@ -12726,7 +12727,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12726
12727
|
}
|
|
12727
12728
|
});
|
|
12728
12729
|
}
|
|
12729
|
-
if (nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {
|
|
12730
|
+
if (nextProps.options && nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {
|
|
12730
12731
|
this.setState({
|
|
12731
12732
|
showCorrect: true
|
|
12732
12733
|
}, () => {
|
|
@@ -12768,7 +12769,12 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12768
12769
|
};
|
|
12769
12770
|
}
|
|
12770
12771
|
getChecked(choice) {
|
|
12771
|
-
|
|
12772
|
+
const isPrintMode = this.props.options && this.props.alwaysShowCorrect;
|
|
12773
|
+
if (isPrintMode) {
|
|
12774
|
+
return choice.correct || false;
|
|
12775
|
+
}
|
|
12776
|
+
const isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';
|
|
12777
|
+
if (isEvaluateMode) {
|
|
12772
12778
|
return choice.correct || false;
|
|
12773
12779
|
}
|
|
12774
12780
|
return this.isSelected(choice.value);
|
|
@@ -12783,19 +12789,19 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12783
12789
|
__self: this,
|
|
12784
12790
|
__source: {
|
|
12785
12791
|
fileName: _jsxFileName$1,
|
|
12786
|
-
lineNumber:
|
|
12792
|
+
lineNumber: 227
|
|
12787
12793
|
}
|
|
12788
12794
|
}, "Multiple Choice Question") : React$2.createElement('h2', {
|
|
12789
12795
|
className: classes.srOnly,
|
|
12790
12796
|
__self: this,
|
|
12791
12797
|
__source: {
|
|
12792
12798
|
fileName: _jsxFileName$1,
|
|
12793
|
-
lineNumber:
|
|
12799
|
+
lineNumber: 229
|
|
12794
12800
|
}
|
|
12795
12801
|
}, "Multiple Select Question");
|
|
12796
12802
|
}
|
|
12797
12803
|
render() {
|
|
12798
|
-
const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt, responseCorrect, teacherInstructions, classes, alwaysShowCorrect, animationsDisabled, language, isSelectionButtonBelow, minSelections, maxSelections, autoplayAudioEnabled, session, customAudioButton} = this.props;
|
|
12804
|
+
const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt, responseCorrect, teacherInstructions, classes, alwaysShowCorrect, animationsDisabled, language, isSelectionButtonBelow, minSelections, maxSelections, autoplayAudioEnabled, session, customAudioButton, options} = this.props;
|
|
12799
12805
|
const {showCorrect, maxSelectionsErrorState} = this.state;
|
|
12800
12806
|
const isEvaluateMode = mode === 'evaluate';
|
|
12801
12807
|
const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
|
|
@@ -12811,7 +12817,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12811
12817
|
__self: this,
|
|
12812
12818
|
__source: {
|
|
12813
12819
|
fileName: _jsxFileName$1,
|
|
12814
|
-
lineNumber:
|
|
12820
|
+
lineNumber: 264
|
|
12815
12821
|
}
|
|
12816
12822
|
});
|
|
12817
12823
|
const getMultipleChoiceMinSelectionErrorMessage = () => {
|
|
@@ -12839,21 +12845,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12839
12845
|
__self: this,
|
|
12840
12846
|
__source: {
|
|
12841
12847
|
fileName: _jsxFileName$1,
|
|
12842
|
-
lineNumber:
|
|
12848
|
+
lineNumber: 287
|
|
12843
12849
|
}
|
|
12844
12850
|
}, partLabel && React$2.createElement('h3', {
|
|
12845
12851
|
className: classes.partLabel,
|
|
12846
12852
|
__self: this,
|
|
12847
12853
|
__source: {
|
|
12848
12854
|
fileName: _jsxFileName$1,
|
|
12849
|
-
lineNumber:
|
|
12855
|
+
lineNumber: 288
|
|
12850
12856
|
}
|
|
12851
12857
|
}, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
|
|
12852
12858
|
className: classes.teacherInstructions,
|
|
12853
12859
|
__self: this,
|
|
12854
12860
|
__source: {
|
|
12855
12861
|
fileName: _jsxFileName$1,
|
|
12856
|
-
lineNumber:
|
|
12862
|
+
lineNumber: 293
|
|
12857
12863
|
}
|
|
12858
12864
|
}, !animationsDisabled ? React$2.createElement(Collapsible, {
|
|
12859
12865
|
labels: {
|
|
@@ -12863,14 +12869,14 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12863
12869
|
__self: this,
|
|
12864
12870
|
__source: {
|
|
12865
12871
|
fileName: _jsxFileName$1,
|
|
12866
|
-
lineNumber:
|
|
12872
|
+
lineNumber: 295
|
|
12867
12873
|
}
|
|
12868
12874
|
}, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
|
|
12869
12875
|
className: classes.fieldset,
|
|
12870
12876
|
__self: this,
|
|
12871
12877
|
__source: {
|
|
12872
12878
|
fileName: _jsxFileName$1,
|
|
12873
|
-
lineNumber:
|
|
12879
|
+
lineNumber: 309
|
|
12874
12880
|
}
|
|
12875
12881
|
}, React$2.createElement(PreviewPrompt, {
|
|
12876
12882
|
className: "prompt",
|
|
@@ -12882,9 +12888,9 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12882
12888
|
__self: this,
|
|
12883
12889
|
__source: {
|
|
12884
12890
|
fileName: _jsxFileName$1,
|
|
12885
|
-
lineNumber:
|
|
12891
|
+
lineNumber: 310
|
|
12886
12892
|
}
|
|
12887
|
-
}), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
|
|
12893
|
+
}), !(options && alwaysShowCorrect) && React$2.createElement(CorrectAnswerToggle, {
|
|
12888
12894
|
show: showCorrectAnswerToggle,
|
|
12889
12895
|
toggled: showCorrect,
|
|
12890
12896
|
onToggle: this.onToggle.bind(this),
|
|
@@ -12892,7 +12898,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12892
12898
|
__self: this,
|
|
12893
12899
|
__source: {
|
|
12894
12900
|
fileName: _jsxFileName$1,
|
|
12895
|
-
lineNumber:
|
|
12901
|
+
lineNumber: 320
|
|
12896
12902
|
}
|
|
12897
12903
|
}), React$2.createElement('div', {
|
|
12898
12904
|
className: classNames({
|
|
@@ -12903,7 +12909,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12903
12909
|
__self: this,
|
|
12904
12910
|
__source: {
|
|
12905
12911
|
fileName: _jsxFileName$1,
|
|
12906
|
-
lineNumber:
|
|
12912
|
+
lineNumber: 328
|
|
12907
12913
|
}
|
|
12908
12914
|
}, choices.map((choice, index) => React$2.createElement(StyledChoice, {
|
|
12909
12915
|
choicesLayout: this.props.choicesLayout,
|
|
@@ -12926,21 +12932,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12926
12932
|
__self: this,
|
|
12927
12933
|
__source: {
|
|
12928
12934
|
fileName: _jsxFileName$1,
|
|
12929
|
-
lineNumber:
|
|
12935
|
+
lineNumber: 336
|
|
12930
12936
|
}
|
|
12931
12937
|
})))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
|
|
12932
12938
|
className: classes.errorText,
|
|
12933
12939
|
__self: this,
|
|
12934
12940
|
__source: {
|
|
12935
12941
|
fileName: _jsxFileName$1,
|
|
12936
|
-
lineNumber:
|
|
12942
|
+
lineNumber: 360
|
|
12937
12943
|
}
|
|
12938
12944
|
}, getMultipleChoiceMinSelectionErrorMessage()), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
|
|
12939
12945
|
className: classes.errorText,
|
|
12940
12946
|
__self: this,
|
|
12941
12947
|
__source: {
|
|
12942
12948
|
fileName: _jsxFileName$1,
|
|
12943
|
-
lineNumber:
|
|
12949
|
+
lineNumber: 365
|
|
12944
12950
|
}
|
|
12945
12951
|
}, translator$1.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
|
|
12946
12952
|
lng: language,
|
|
@@ -12958,13 +12964,14 @@ var MultipleChoice$2 = styles$b.withStyles(styles$1)(MultipleChoice$1);
|
|
|
12958
12964
|
const React$1 = _dll_react;
|
|
12959
12965
|
const PropTypes = _dll_prop_types;
|
|
12960
12966
|
const {PreviewLayout: PreviewLayout} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
12961
|
-
const _jsxFileName = "/
|
|
12967
|
+
const _jsxFileName = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/main.jsx";
|
|
12962
12968
|
const styles = () => ({});
|
|
12963
12969
|
class Main extends React$1.Component {
|
|
12964
12970
|
static __initStatic() {
|
|
12965
12971
|
this.propTypes = {
|
|
12966
12972
|
model: PropTypes.object,
|
|
12967
12973
|
session: PropTypes.object,
|
|
12974
|
+
options: PropTypes.object,
|
|
12968
12975
|
onChoiceChanged: PropTypes.func,
|
|
12969
12976
|
classes: PropTypes.object.isRequired,
|
|
12970
12977
|
onShowCorrectToggle: PropTypes.func,
|
|
@@ -12984,7 +12991,7 @@ class Main extends React$1.Component {
|
|
|
12984
12991
|
super(props);
|
|
12985
12992
|
}
|
|
12986
12993
|
render() {
|
|
12987
|
-
const {model, onChoiceChanged, session, onShowCorrectToggle} = this.props;
|
|
12994
|
+
const {model, onChoiceChanged, session, onShowCorrectToggle, options} = this.props;
|
|
12988
12995
|
const {extraCSSRules, fontSizeFactor} = model;
|
|
12989
12996
|
return React$1.createElement(PreviewLayout, {
|
|
12990
12997
|
extraCSSRules: extraCSSRules,
|
|
@@ -12992,17 +12999,18 @@ class Main extends React$1.Component {
|
|
|
12992
12999
|
__self: this,
|
|
12993
13000
|
__source: {
|
|
12994
13001
|
fileName: _jsxFileName,
|
|
12995
|
-
lineNumber:
|
|
13002
|
+
lineNumber: 38
|
|
12996
13003
|
}
|
|
12997
13004
|
}, React$1.createElement(MultipleChoice$2, {
|
|
12998
13005
|
...model,
|
|
13006
|
+
options: options,
|
|
12999
13007
|
session: session,
|
|
13000
13008
|
onChoiceChanged: onChoiceChanged,
|
|
13001
13009
|
onShowCorrectToggle: onShowCorrectToggle,
|
|
13002
13010
|
__self: this,
|
|
13003
13011
|
__source: {
|
|
13004
13012
|
fileName: _jsxFileName,
|
|
13005
|
-
lineNumber:
|
|
13013
|
+
lineNumber: 39
|
|
13006
13014
|
}
|
|
13007
13015
|
}));
|
|
13008
13016
|
}
|
|
@@ -13022,14 +13030,14 @@ const Root = props => React$1.createElement(styles$b.MuiThemeProvider, {
|
|
|
13022
13030
|
__self: undefined,
|
|
13023
13031
|
__source: {
|
|
13024
13032
|
fileName: _jsxFileName,
|
|
13025
|
-
lineNumber:
|
|
13033
|
+
lineNumber: 60
|
|
13026
13034
|
}
|
|
13027
13035
|
}, React$1.createElement(Styled, {
|
|
13028
13036
|
...props,
|
|
13029
13037
|
__self: undefined,
|
|
13030
13038
|
__source: {
|
|
13031
13039
|
fileName: _jsxFileName,
|
|
13032
|
-
lineNumber:
|
|
13040
|
+
lineNumber: 61
|
|
13033
13041
|
}
|
|
13034
13042
|
}));
|
|
13035
13043
|
var lib = {};
|
|
@@ -13148,6 +13156,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
13148
13156
|
super();
|
|
13149
13157
|
this._model = null;
|
|
13150
13158
|
this._session = null;
|
|
13159
|
+
this._options = null;
|
|
13151
13160
|
this.audioComplete = false;
|
|
13152
13161
|
this._boundHandleKeyDown = this.handleKeyDown.bind(this);
|
|
13153
13162
|
this._keyboardEventsEnabled = false;
|
|
@@ -13156,6 +13165,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
13156
13165
|
var element = React.createElement(Root, {
|
|
13157
13166
|
model: this._model,
|
|
13158
13167
|
session: this._session,
|
|
13168
|
+
options: this._options,
|
|
13159
13169
|
onChoiceChanged: this._onChange.bind(this),
|
|
13160
13170
|
onShowCorrectToggle: this.onShowCorrectToggle.bind(this)
|
|
13161
13171
|
});
|
|
@@ -13202,6 +13212,13 @@ class MultipleChoice extends HTMLElement {
|
|
|
13202
13212
|
get session() {
|
|
13203
13213
|
return this._session;
|
|
13204
13214
|
}
|
|
13215
|
+
get options() {
|
|
13216
|
+
return this._options;
|
|
13217
|
+
}
|
|
13218
|
+
set options(o) {
|
|
13219
|
+
this._options = o;
|
|
13220
|
+
this._rerender();
|
|
13221
|
+
}
|
|
13205
13222
|
set session(s) {
|
|
13206
13223
|
this._session = s;
|
|
13207
13224
|
this._rerender();
|
|
@@ -13441,6 +13458,7 @@ class Ebsr extends HTMLElement {
|
|
|
13441
13458
|
keyMode: this._model[key].choicePrefix,
|
|
13442
13459
|
partLabel: labels[key]
|
|
13443
13460
|
};
|
|
13461
|
+
part.options = this._options;
|
|
13444
13462
|
if (!part._session) {
|
|
13445
13463
|
part.session = {};
|
|
13446
13464
|
}
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr",
|
|
3
|
-
"version": "10.5.
|
|
3
|
+
"version": "10.5.3-hotfix.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@pie-element/multiple-choice": "^9.15.
|
|
10
|
+
"@pie-element/multiple-choice": "^9.15.3-hotfix.1",
|
|
11
11
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
12
|
-
"@pie-lib/pie-toolbox": "2.14.
|
|
12
|
+
"@pie-lib/pie-toolbox": "2.14.3",
|
|
13
13
|
"classnames": "^2.2.5",
|
|
14
14
|
"debug": "^4.1.1",
|
|
15
15
|
"lodash": "^4.17.11"
|
|
16
16
|
},
|
|
17
17
|
"author": "pie framework developers",
|
|
18
18
|
"license": "ISC",
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "0e14ff981bcdc8a89a0e58484026496701bfdbc3",
|
|
20
20
|
"scripts": {
|
|
21
21
|
"postpublish": "../../scripts/postpublish"
|
|
22
22
|
},
|
package/src/print.js
CHANGED
|
@@ -142,6 +142,9 @@ export default class Ebsr extends HTMLElement {
|
|
|
142
142
|
partLabel: labels[key]
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
+
// pass options to enable print mode detection in multiple-choice component
|
|
146
|
+
part.options = this._options;
|
|
147
|
+
|
|
145
148
|
if (!part._session) {
|
|
146
149
|
// for print, "set session" is not called,
|
|
147
150
|
// but ebsr needs sessions in order to render the elements,
|
package/LICENSE.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
Copyright 2019 CoreSpring Inc
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
|
-
|
|
5
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|