@pie-element/multiple-choice 13.2.0-next.0 → 13.2.0-next.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 +8 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/lib/index.js +4 -1
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +12 -6
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +6 -0
- package/controller/package.json +2 -2
- package/module/configure.js +1 -1
- package/module/element.js +1 -1
- package/module/manifest.json +5 -1
- package/module/print.js +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
# [13.2.0-next.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@13.2.0-next.0...@pie-element/multiple-choice@13.2.0-next.1) (2026-05-06)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- bump libs and shared modules PIE-440, PIE-436, PIE-439, PIE-519, PIE-216 ([932fc12](https://github.com/pie-framework/pie-elements/commit/932fc12557ba56a737cee005be898d54d5e590ef))
|
|
11
|
+
- fixed tests [PIE-439] ([aef44f6](https://github.com/pie-framework/pie-elements/commit/aef44f686c0d69c83f3fe464509092d68b32cbc1))
|
|
12
|
+
- make sure initial changes to the model are applied to what is needed [PIE-439] ([892a3cc](https://github.com/pie-framework/pie-elements/commit/892a3cc4c6f0b37cb65f42cfdd9a9a01db447aed))
|
|
13
|
+
|
|
6
14
|
# [13.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@13.0.1...@pie-element/multiple-choice@13.1.0) (2026-05-04)
|
|
7
15
|
|
|
8
16
|
### Features
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.1.0-next.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@10.1.0-next.0...@pie-element/multiple-choice-configure@10.1.0-next.1) (2026-05-06)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- bump libs and shared modules PIE-440, PIE-436, PIE-439, PIE-519, PIE-216 ([932fc12](https://github.com/pie-framework/pie-elements/commit/932fc12557ba56a737cee005be898d54d5e590ef))
|
|
11
|
+
- fixed tests [PIE-439] ([aef44f6](https://github.com/pie-framework/pie-elements/commit/aef44f686c0d69c83f3fe464509092d68b32cbc1))
|
|
12
|
+
- make sure initial changes to the model are applied to what is needed [PIE-439] ([892a3cc](https://github.com/pie-framework/pie-elements/commit/892a3cc4c6f0b37cb65f42cfdd9a9a01db447aed))
|
|
13
|
+
|
|
6
14
|
## [10.0.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@10.0.0...@pie-element/multiple-choice-configure@10.0.1) (2026-04-28)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
package/configure/lib/index.js
CHANGED
|
@@ -101,7 +101,10 @@ class MultipleChoice extends HTMLElement {
|
|
|
101
101
|
this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model, resetValue));
|
|
102
102
|
}
|
|
103
103
|
onModelChanged(m, reset) {
|
|
104
|
-
this._model =
|
|
104
|
+
this._model = {
|
|
105
|
+
...this._model,
|
|
106
|
+
...m
|
|
107
|
+
};
|
|
105
108
|
this._render();
|
|
106
109
|
this.dispatchModelUpdated(reset);
|
|
107
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_debug","_pieConfigureEvents","_main","_configUi","_lodashEs","_defaults","log","debug","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","defaults","sensibleDefaults","answerChoiceCount","MultipleChoice","HTMLElement","constructor","_root","_reactContainer","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","newConfiguration","language","enabled","languageChoices","options","settings","find","option","disableSidePanel","_disableSidePanel","dispatchModelUpdated","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","element","React","createElement","Main","imageSupport","add","delete","uploadSoundSupport","document","className","appendChild","createRoot","render","error","console","stack","connectedCallback","disconnectedCallback","unmount","exports","default","_defineProperty2","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\nimport {\n DeleteImageEvent,\n InsertImageEvent,\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport { defaults } from 'lodash-es';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: '',\n },\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices(\n (model && model.choices) || [],\n configuration && configuration.answerChoiceCount,\n ),\n },\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || []),\n });\n\n // This is used for offering support for old models which have the property \"verticalMode\"\n normalizedModel.choicesLayout =\n model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._root = null;\n this._reactContainer = null;\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n\n const newConfiguration = {\n ...sensibleDefaults.configuration,\n ...info.configuration,\n };\n this._configuration = newConfiguration;\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\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = m;\n this._render();\n\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\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 log('_render - Starting render');\n log('_render - Model:', this._model ? 'present' : 'missing');\n log('_render - Configuration:', this._configuration ? 'present' : 'missing');\n log('_render - Root exists:', !!this._root);\n\n try {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\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 log('_render - Creating React container');\n\n // Create a container div for React to render into\n this._reactContainer = document.createElement('div');\n this._reactContainer.className = 'pie-configure-wrapper';\n this.appendChild(this._reactContainer);\n\n log('_render - Creating new React root');\n this._root = createRoot(this._reactContainer);\n log('_render - React root created successfully');\n }\n\n log('_render - Calling root.render()');\n this._root.render(element);\n log('_render - Render completed successfully');\n } catch (error) {\n console.error('❌ [multiple-choice-configure] Render error:', error);\n console.error('Error stack:', error.stack);\n throw error;\n }\n }\n\n connectedCallback() {\n log('connectedCallback - Component connected to DOM');\n log('connectedCallback - Model:', this._model ? 'present' : 'missing');\n log('connectedCallback - Configuration:', this._configuration ? 'present' : 'missing');\n }\n\n disconnectedCallback() {\n log('disconnectedCallback - Component disconnected from DOM');\n if (this._root) {\n log('disconnectedCallback - Unmounting React root');\n this._root.unmount();\n this._root = null;\n }\n if (this._reactContainer) {\n this._reactContainer = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,MAAMQ,GAAG,GAAG,IAAAC,cAAK,EAAC,2BAA2B,CAAC;AAE9C,MAAMC,wBAAwB,GAAGA,CAACC,OAAO,EAAEC,WAAW,GAAG,CAAC,KAAK;EAC7D,IAAI,CAACD,OAAO,IAAIA,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;IACpC,IAAIC,gBAAgB,GAAG,EAAE;IAEzB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,WAAW,EAAEG,CAAC,EAAE,EAAE;MACpCD,gBAAgB,CAACE,IAAI,CAAC;QACpBC,KAAK,EAAE,GAAGF,CAAC,EAAE;QACbG,KAAK,EAAE,EAAE;QACTC,QAAQ,EAAE;UACRC,IAAI,EAAE,MAAM;UACZH,KAAK,EAAE;QACT;MACF,CAAC,CAAC;IACJ;IAEA,OAAOH,gBAAgB;EACzB;EAEA,OAAOH,OAAO;AAChB,CAAC;AAED,MAAMU,0BAA0B,GAAGA,CAACC,MAAM,EAAEC,KAAK,KAAK;EACpD,MAAMC,aAAa,GAAG,IAAAC,kBAAQ,EAACH,MAAM,EAAEI,iBAAgB,CAACF,aAAa,CAAC;EAEtE,OAAO;IACLA,aAAa;IACbD,KAAK,EA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EAE/G,OAAOH,eAAe;AACxB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_debug","_pieConfigureEvents","_main","_configUi","_lodashEs","_defaults","log","debug","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","defaults","sensibleDefaults","answerChoiceCount","MultipleChoice","HTMLElement","constructor","_root","_reactContainer","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","newConfiguration","language","enabled","languageChoices","options","settings","find","option","disableSidePanel","_disableSidePanel","dispatchModelUpdated","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","element","React","createElement","Main","imageSupport","add","delete","uploadSoundSupport","document","className","appendChild","createRoot","render","error","console","stack","connectedCallback","disconnectedCallback","unmount","exports","default","_defineProperty2","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\nimport {\n DeleteImageEvent,\n InsertImageEvent,\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport { defaults } from 'lodash-es';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: '',\n },\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices(\n (model && model.choices) || [],\n configuration && configuration.answerChoiceCount,\n ),\n },\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || []),\n });\n\n // This is used for offering support for old models which have the property \"verticalMode\"\n normalizedModel.choicesLayout =\n model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._root = null;\n this._reactContainer = null;\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n\n const newConfiguration = {\n ...sensibleDefaults.configuration,\n ...info.configuration,\n };\n this._configuration = newConfiguration;\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\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = {\n ...this._model,\n ...m,\n };\n this._render();\n\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\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 log('_render - Starting render');\n log('_render - Model:', this._model ? 'present' : 'missing');\n log('_render - Configuration:', this._configuration ? 'present' : 'missing');\n log('_render - Root exists:', !!this._root);\n\n try {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\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 log('_render - Creating React container');\n\n // Create a container div for React to render into\n this._reactContainer = document.createElement('div');\n this._reactContainer.className = 'pie-configure-wrapper';\n this.appendChild(this._reactContainer);\n\n log('_render - Creating new React root');\n this._root = createRoot(this._reactContainer);\n log('_render - React root created successfully');\n }\n\n log('_render - Calling root.render()');\n this._root.render(element);\n log('_render - Render completed successfully');\n } catch (error) {\n console.error('❌ [multiple-choice-configure] Render error:', error);\n console.error('Error stack:', error.stack);\n throw error;\n }\n }\n\n connectedCallback() {\n log('connectedCallback - Component connected to DOM');\n log('connectedCallback - Model:', this._model ? 'present' : 'missing');\n log('connectedCallback - Configuration:', this._configuration ? 'present' : 'missing');\n }\n\n disconnectedCallback() {\n log('disconnectedCallback - Component disconnected from DOM');\n if (this._root) {\n log('disconnectedCallback - Unmounting React root');\n this._root.unmount();\n this._root = null;\n }\n if (this._reactContainer) {\n this._reactContainer = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,MAAMQ,GAAG,GAAG,IAAAC,cAAK,EAAC,2BAA2B,CAAC;AAE9C,MAAMC,wBAAwB,GAAGA,CAACC,OAAO,EAAEC,WAAW,GAAG,CAAC,KAAK;EAC7D,IAAI,CAACD,OAAO,IAAIA,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;IACpC,IAAIC,gBAAgB,GAAG,EAAE;IAEzB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,WAAW,EAAEG,CAAC,EAAE,EAAE;MACpCD,gBAAgB,CAACE,IAAI,CAAC;QACpBC,KAAK,EAAE,GAAGF,CAAC,EAAE;QACbG,KAAK,EAAE,EAAE;QACTC,QAAQ,EAAE;UACRC,IAAI,EAAE,MAAM;UACZH,KAAK,EAAE;QACT;MACF,CAAC,CAAC;IACJ;IAEA,OAAOH,gBAAgB;EACzB;EAEA,OAAOH,OAAO;AAChB,CAAC;AAED,MAAMU,0BAA0B,GAAGA,CAACC,MAAM,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,OAAO,IAAK,EAAE;EAClE,CAAC,CAAC;;EAEF;EACAiF,eAAe,CAACG,aAAa,GAC3BxE,KAAK,CAACwE,aAAa,IAAKxE,KAAK,CAACyE,YAAY,KAAK,KAAK,IAAI,YAAa,IAAItE,iBAAgB,CAACH,KAAK,CAACwE,aAAa;EAE/G,OAAOH,eAAe;AACxB,CAAC","ignoreList":[]}
|
package/configure/lib/main.js
CHANGED
|
@@ -349,7 +349,9 @@ class Main extends _react.default.Component {
|
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
351
|
model.choices.splice(index, 1);
|
|
352
|
-
onModelChanged(
|
|
352
|
+
onModelChanged({
|
|
353
|
+
choices: model.choices
|
|
354
|
+
});
|
|
353
355
|
});
|
|
354
356
|
(0, _defineProperty2.default)(this, "onAddChoice", () => {
|
|
355
357
|
const {
|
|
@@ -378,7 +380,9 @@ class Main extends _react.default.Component {
|
|
|
378
380
|
type: 'none'
|
|
379
381
|
}
|
|
380
382
|
});
|
|
381
|
-
onModelChanged(
|
|
383
|
+
onModelChanged({
|
|
384
|
+
choices: model.choices
|
|
385
|
+
});
|
|
382
386
|
});
|
|
383
387
|
(0, _defineProperty2.default)(this, "onChoiceChanged", (index, choice) => {
|
|
384
388
|
const {
|
|
@@ -391,17 +395,17 @@ class Main extends _react.default.Component {
|
|
|
391
395
|
}));
|
|
392
396
|
}
|
|
393
397
|
model.choices.splice(index, 1, choice);
|
|
394
|
-
onModelChanged(
|
|
398
|
+
onModelChanged({
|
|
399
|
+
choices: model.choices
|
|
400
|
+
});
|
|
395
401
|
});
|
|
396
402
|
(0, _defineProperty2.default)(this, "onPromptChanged", prompt => {
|
|
397
403
|
this.props.onModelChanged({
|
|
398
|
-
...this.props.model,
|
|
399
404
|
prompt
|
|
400
405
|
});
|
|
401
406
|
});
|
|
402
407
|
(0, _defineProperty2.default)(this, "onTeacherInstructionsChanged", teacherInstructions => {
|
|
403
408
|
this.props.onModelChanged({
|
|
404
|
-
...this.props.model,
|
|
405
409
|
teacherInstructions
|
|
406
410
|
});
|
|
407
411
|
});
|
|
@@ -426,7 +430,9 @@ class Main extends _react.default.Component {
|
|
|
426
430
|
return c;
|
|
427
431
|
});
|
|
428
432
|
}
|
|
429
|
-
onModelChanged(
|
|
433
|
+
onModelChanged({
|
|
434
|
+
choices: model.choices
|
|
435
|
+
}, true);
|
|
430
436
|
break;
|
|
431
437
|
}
|
|
432
438
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_editableHtmlTipTap","_configUi","_renderUi","_Button","_Tooltip","_Typography","_Box","_Info","_lodashEs","_utils","Panel","toggle","radio","dropdown","settings","MAX_CHOICES","PromptHolder","styled","InputContainer","theme","width","paddingTop","spacing","marginBottom","RationaleHolder","flex","marginTop","marginLeft","ChoiceConfigurationHolder","display","flexDirection","AddButton","Button","float","DisableButton","cursor","pointerEvents","backgroundColor","color","disabled","FlexContainer","Box","alignItems","TitleText","Typography","fontSize","typography","marginRight","StyledTooltip","Tooltip","whiteSpace","maxWidth","ErrorText","palette","error","main","Design","props","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","uploadSoundSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","contentDimensions","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","rationale","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","spellCheck","gridColumns","maxImageWidth","maxImageHeight","prompt","withRubric","mathMlOptions","language","languageChoices","maxAnswerChoices","limitChoicesNumber","teacherInstructionsEnabled","rationaleEnabled","feedbackEnabled","promptEnabled","spellCheckEnabled","choices","errors","toolbarEditorPosition","extraCSSRules","answerChoices","answerChoicesError","choicesErrors","correctResponse","correctResponseError","promptError","rationaleErrors","teacherInstructionsError","nrOfColumnsAvailable","length","Array","from","_","i","baseInputConfiguration","toolbarOpts","position","getPluginProps","validationMessage","generateValidationMessage","defaultImageMaxWidth","defaultImageMaxHeight","addChoiceButtonTooltip","panelSettings","label","enabled","options","panelProperties","studentInstructionsEnabled","rubricEnabled","default","createElement","layout","ConfigLayout","dimensions","hideSettings","classes","onChangeConfiguration","groups","Settings","Properties","markup","onChange","nonEmpty","disableUnderline","pluginProps","inputConfiguration","languageCharactersProps","component","disableFocusListener","disableTouchListener","placement","title","map","choice","index","key","ChoiceConfiguration","useLetterOrdering","mode","data","defaultFeedback","disableImageAlignmentButtons","onDelete","c","allowFeedBack","allowDelete","noLabels","pluginOpts","value","noCorrectAnswerError","variant","onClick","Main","React","Component","constructor","args","_defineProperty2","showWarning","onModelChanged","minAnswerChoices","setState","splice","push","utils","firstAvailableIndex","type","correct","merge","correctFound","render","state","Fragment","AlertDialog","open","text","onConfirm","_extends2","exports","PropTypes","object","isRequired","disableSidePanel","bool","func","shape","add","delete","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport {\n AlertDialog,\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils,\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport Button from '@mui/material/Button';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\nimport Box from '@mui/material/Box';\nimport Info from '@mui/icons-material/Info';\nimport { merge } from 'lodash-es';\nimport { generateValidationMessage } from './utils';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst PromptHolder = styled(InputContainer)(({ theme }) => ({\n width: '100%',\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n}));\n\nconst RationaleHolder = styled(InputContainer)(({ theme }) => ({\n flex: 1,\n marginTop: theme.spacing(1.5),\n paddingTop: theme.spacing(2),\n marginLeft: theme.spacing(3.5),\n}));\n\nconst ChoiceConfigurationHolder = styled(InputContainer)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n marginBottom: theme.spacing(1),\n width: '100%',\n}));\n\n\nconst AddButton = styled(Button)(({ theme }) => ({\n marginTop: theme.spacing(1),\n float: 'right',\n}));\n\nconst DisableButton = styled(AddButton)({\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n },\n});\n\nconst FlexContainer = styled(Box)({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst TitleText = styled(Typography)(({ theme }) => ({\n fontSize: theme.typography.fontSize + 2,\n marginRight: theme.spacing(1),\n}));\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n '& .MuiTooltip-tooltip': {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nconst Design = (props) => {\n const {\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n uploadSoundSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged,\n } = props;\n\n const {\n addChoiceButton = {},\n contentDimensions = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n spellCheck = {},\n gridColumns,\n maxImageWidth = {},\n maxImageHeight = {},\n prompt = {},\n withRubric = {},\n mathMlOptions = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n let { maxAnswerChoices } = configuration || {};\n const {\n limitChoicesNumber,\n teacherInstructionsEnabled,\n rationaleEnabled,\n feedbackEnabled,\n promptEnabled,\n spellCheckEnabled,\n choices,\n errors,\n toolbarEditorPosition,\n extraCSSRules,\n } = model || {};\n\n const {\n answerChoices: answerChoicesError,\n choices: choicesErrors,\n correctResponse: correctResponseError,\n prompt: promptError,\n rationale: rationaleErrors,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n const nrOfColumnsAvailable = choices?.length ? Array.from({ length: choices.length }, (_, i) => `${i + 1}`) : [];\n\n const { baseInputConfiguration = {} } = configuration;\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n const getPluginProps = (props = {}) => ({\n ...baseInputConfiguration,\n ...props,\n });\n\n const validationMessage = generateValidationMessage(configuration);\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n const addChoiceButtonTooltip =\n maxAnswerChoices && choices?.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : '';\n\n const panelSettings = {\n choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),\n choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings &&\n model.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n return (\n <layout.ConfigLayout\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n extraCSSRules={extraCSSRules}\n classes={{}}\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <PromptHolder label={teacherInstructions.label}>\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.teacherInstructions?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </PromptHolder>\n )}\n\n {promptEnabled && (\n <PromptHolder label={prompt.label}>\n <EditableHtml\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n error={promptError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.prompt?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <ErrorText>{promptError}</ErrorText>}\n </PromptHolder>\n )}\n\n <FlexContainer>\n <TitleText component={'div'}>\n Choices\n </TitleText>\n <StyledTooltip\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} />\n </StyledTooltip>\n </FlexContainer>\n\n {choices.map((choice, index) => (\n <ChoiceConfigurationHolder key={`choice-${index}`}>\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n disableImageAlignmentButtons={true}\n onDelete={() => onRemoveChoice(index)}\n onChange={(c) => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n pluginOpts={getPluginProps(configuration?.choices?.inputConfiguration)}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n error={choicesErrors?.[choice.value] || null}\n noCorrectAnswerError={correctResponseError}\n maxImageWidth={(maxImageWidth && maxImageWidth.choices) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.choices) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n />\n\n {rationaleEnabled && (\n <RationaleHolder key={`rationale-${index}`} label={rationale.label}>\n <EditableHtml\n markup={choice.rationale || ''}\n onChange={(c) => onChoiceChanged(index, { ...choice, rationale: c })}\n imageSupport={imageSupport}\n error={rationaleErrors?.[choice.value] || null}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.rationale?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {rationaleErrors?.[choice.value] && (\n <ErrorText>{rationaleErrors?.[choice.value]}</ErrorText>\n )}\n </RationaleHolder>\n )}\n </ChoiceConfigurationHolder>\n ))}\n\n {correctResponseError && <ErrorText>{correctResponseError}</ErrorText>}\n {answerChoicesError && <ErrorText>{answerChoicesError}</ErrorText>}\n\n {addChoiceButton.settings && (\n <StyledTooltip title={addChoiceButtonTooltip}>\n {maxAnswerChoices && choices?.length >= maxAnswerChoices ? (\n <DisableButton\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n disabled\n >\n {addChoiceButton.label}\n </DisableButton>\n ) : (\n <AddButton\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </AddButton>\n )}\n </StyledTooltip>\n )}\n </layout.ConfigLayout>\n );\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n state = { showWarning: false };\n\n onRemoveChoice = (index) => {\n const { model, configuration, onModelChanged } = this.props;\n const { minAnswerChoices } = configuration || {};\n\n if (minAnswerChoices && model.choices.length === minAnswerChoices) {\n this.setState({ showWarning: true });\n\n return;\n }\n\n model.choices.splice(index, 1);\n onModelChanged(model);\n };\n\n onAddChoice = () => {\n const { model, configuration, onModelChanged } = this.props;\n let { maxAnswerChoices } = configuration || {};\n const { limitChoicesNumber } = model || {};\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {\n return;\n }\n\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(\n model.choices.map((c) => c.value),\n 0,\n ),\n feedback: { type: 'none' },\n });\n\n onModelChanged(model);\n };\n\n onChoiceChanged = (index, choice) => {\n const { model, onModelChanged } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map((c) => merge({}, c, { correct: false }));\n }\n\n model.choices.splice(index, 1, choice);\n onModelChanged(model);\n };\n\n onPromptChanged = (prompt) => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt,\n });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions,\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map((c) => {\n if (correctFound) {\n c.correct = false;\n\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n\n return c;\n });\n }\n\n onModelChanged(model, true);\n break;\n }\n\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n const { configuration: { minAnswerChoices } = {} } = this.props;\n const { showWarning } = this.state;\n\n return (\n <React.Fragment>\n <AlertDialog\n open={showWarning}\n title=\"Warning\"\n text={`There can't be less than ${minAnswerChoices || 0} choices.`}\n onConfirm={() => this.setState({ showWarning: false })}\n />\n <Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n />\n </React.Fragment>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;;AAA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C,UAAU;EAClCnJ,aAAa,EAAEiJ,kBAAS,CAACC,MAAM,CAACC,UAAU;EAC1CC,gBAAgB,EAAEH,kBAAS,CAACI,IAAI;EAChCxB,cAAc,EAAEoB,kBAAS,CAACK,IAAI,CAACH,UAAU;EACzC3I,sBAAsB,EAAEyI,kBAAS,CAACK,IAAI,CAACH,UAAU;EACjD9I,YAAY,EAAE4I,kBAAS,CAACM,KAAK,CAAC;IAC5BC,GAAG,EAAEP,kBAAS,CAACK,IAAI,CAACH,UAAU;IAC9BM,MAAM,EAAER,kBAAS,CAACK,IAAI,CAACH;EACzB,CAAC;AACH,CAAC;AAAA,IAAAO,QAAA,GAAAV,OAAA,CAAArE,OAAA,GAkIY2C,IAAI","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_editableHtmlTipTap","_configUi","_renderUi","_Button","_Tooltip","_Typography","_Box","_Info","_lodashEs","_utils","Panel","toggle","radio","dropdown","settings","MAX_CHOICES","PromptHolder","styled","InputContainer","theme","width","paddingTop","spacing","marginBottom","RationaleHolder","flex","marginTop","marginLeft","ChoiceConfigurationHolder","display","flexDirection","AddButton","Button","float","DisableButton","cursor","pointerEvents","backgroundColor","color","disabled","FlexContainer","Box","alignItems","TitleText","Typography","fontSize","typography","marginRight","StyledTooltip","Tooltip","whiteSpace","maxWidth","ErrorText","palette","error","main","Design","props","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","uploadSoundSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","contentDimensions","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","rationale","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","spellCheck","gridColumns","maxImageWidth","maxImageHeight","prompt","withRubric","mathMlOptions","language","languageChoices","maxAnswerChoices","limitChoicesNumber","teacherInstructionsEnabled","rationaleEnabled","feedbackEnabled","promptEnabled","spellCheckEnabled","choices","errors","toolbarEditorPosition","extraCSSRules","answerChoices","answerChoicesError","choicesErrors","correctResponse","correctResponseError","promptError","rationaleErrors","teacherInstructionsError","nrOfColumnsAvailable","length","Array","from","_","i","baseInputConfiguration","toolbarOpts","position","getPluginProps","validationMessage","generateValidationMessage","defaultImageMaxWidth","defaultImageMaxHeight","addChoiceButtonTooltip","panelSettings","label","enabled","options","panelProperties","studentInstructionsEnabled","rubricEnabled","default","createElement","layout","ConfigLayout","dimensions","hideSettings","classes","onChangeConfiguration","groups","Settings","Properties","markup","onChange","nonEmpty","disableUnderline","pluginProps","inputConfiguration","languageCharactersProps","component","disableFocusListener","disableTouchListener","placement","title","map","choice","index","key","ChoiceConfiguration","useLetterOrdering","mode","data","defaultFeedback","disableImageAlignmentButtons","onDelete","c","allowFeedBack","allowDelete","noLabels","pluginOpts","value","noCorrectAnswerError","variant","onClick","Main","React","Component","constructor","args","_defineProperty2","showWarning","onModelChanged","minAnswerChoices","setState","splice","push","utils","firstAvailableIndex","type","correct","merge","correctFound","render","state","Fragment","AlertDialog","open","text","onConfirm","_extends2","exports","PropTypes","object","isRequired","disableSidePanel","bool","func","shape","add","delete","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport {\n AlertDialog,\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils,\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport Button from '@mui/material/Button';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\nimport Box from '@mui/material/Box';\nimport Info from '@mui/icons-material/Info';\nimport { merge } from 'lodash-es';\nimport { generateValidationMessage } from './utils';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst PromptHolder = styled(InputContainer)(({ theme }) => ({\n width: '100%',\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n}));\n\nconst RationaleHolder = styled(InputContainer)(({ theme }) => ({\n flex: 1,\n marginTop: theme.spacing(1.5),\n paddingTop: theme.spacing(2),\n marginLeft: theme.spacing(3.5),\n}));\n\nconst ChoiceConfigurationHolder = styled(InputContainer)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n marginBottom: theme.spacing(1),\n width: '100%',\n}));\n\n\nconst AddButton = styled(Button)(({ theme }) => ({\n marginTop: theme.spacing(1),\n float: 'right',\n}));\n\nconst DisableButton = styled(AddButton)({\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n },\n});\n\nconst FlexContainer = styled(Box)({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst TitleText = styled(Typography)(({ theme }) => ({\n fontSize: theme.typography.fontSize + 2,\n marginRight: theme.spacing(1),\n}));\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n '& .MuiTooltip-tooltip': {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nconst Design = (props) => {\n const {\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n uploadSoundSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged,\n } = props;\n\n const {\n addChoiceButton = {},\n contentDimensions = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n spellCheck = {},\n gridColumns,\n maxImageWidth = {},\n maxImageHeight = {},\n prompt = {},\n withRubric = {},\n mathMlOptions = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n let { maxAnswerChoices } = configuration || {};\n const {\n limitChoicesNumber,\n teacherInstructionsEnabled,\n rationaleEnabled,\n feedbackEnabled,\n promptEnabled,\n spellCheckEnabled,\n choices,\n errors,\n toolbarEditorPosition,\n extraCSSRules,\n } = model || {};\n\n const {\n answerChoices: answerChoicesError,\n choices: choicesErrors,\n correctResponse: correctResponseError,\n prompt: promptError,\n rationale: rationaleErrors,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n const nrOfColumnsAvailable = choices?.length ? Array.from({ length: choices.length }, (_, i) => `${i + 1}`) : [];\n\n const { baseInputConfiguration = {} } = configuration;\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n const getPluginProps = (props = {}) => ({\n ...baseInputConfiguration,\n ...props,\n });\n\n const validationMessage = generateValidationMessage(configuration);\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n const addChoiceButtonTooltip =\n maxAnswerChoices && choices?.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : '';\n\n const panelSettings = {\n choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),\n choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings &&\n model.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n return (\n <layout.ConfigLayout\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n extraCSSRules={extraCSSRules}\n classes={{}}\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <PromptHolder label={teacherInstructions.label}>\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.teacherInstructions?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </PromptHolder>\n )}\n\n {promptEnabled && (\n <PromptHolder label={prompt.label}>\n <EditableHtml\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n error={promptError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.prompt?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <ErrorText>{promptError}</ErrorText>}\n </PromptHolder>\n )}\n\n <FlexContainer>\n <TitleText component={'div'}>\n Choices\n </TitleText>\n <StyledTooltip\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} />\n </StyledTooltip>\n </FlexContainer>\n\n {choices.map((choice, index) => (\n <ChoiceConfigurationHolder key={`choice-${index}`}>\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n disableImageAlignmentButtons={true}\n onDelete={() => onRemoveChoice(index)}\n onChange={(c) => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n pluginOpts={getPluginProps(configuration?.choices?.inputConfiguration)}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n error={choicesErrors?.[choice.value] || null}\n noCorrectAnswerError={correctResponseError}\n maxImageWidth={(maxImageWidth && maxImageWidth.choices) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.choices) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n />\n\n {rationaleEnabled && (\n <RationaleHolder key={`rationale-${index}`} label={rationale.label}>\n <EditableHtml\n markup={choice.rationale || ''}\n onChange={(c) => onChoiceChanged(index, { ...choice, rationale: c })}\n imageSupport={imageSupport}\n error={rationaleErrors?.[choice.value] || null}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.rationale?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {rationaleErrors?.[choice.value] && (\n <ErrorText>{rationaleErrors?.[choice.value]}</ErrorText>\n )}\n </RationaleHolder>\n )}\n </ChoiceConfigurationHolder>\n ))}\n\n {correctResponseError && <ErrorText>{correctResponseError}</ErrorText>}\n {answerChoicesError && <ErrorText>{answerChoicesError}</ErrorText>}\n\n {addChoiceButton.settings && (\n <StyledTooltip title={addChoiceButtonTooltip}>\n {maxAnswerChoices && choices?.length >= maxAnswerChoices ? (\n <DisableButton\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n disabled\n >\n {addChoiceButton.label}\n </DisableButton>\n ) : (\n <AddButton\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </AddButton>\n )}\n </StyledTooltip>\n )}\n </layout.ConfigLayout>\n );\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n state = { showWarning: false };\n\n onRemoveChoice = (index) => {\n const { model, configuration, onModelChanged } = this.props;\n const { minAnswerChoices } = configuration || {};\n\n if (minAnswerChoices && model.choices.length === minAnswerChoices) {\n this.setState({ showWarning: true });\n\n return;\n }\n\n model.choices.splice(index, 1);\n onModelChanged({\n choices: model.choices,\n });\n };\n\n onAddChoice = () => {\n const { model, configuration, onModelChanged } = this.props;\n let { maxAnswerChoices } = configuration || {};\n const { limitChoicesNumber } = model || {};\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {\n return;\n }\n\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(\n model.choices.map((c) => c.value),\n 0,\n ),\n feedback: { type: 'none' },\n });\n\n onModelChanged({\n choices: model.choices,\n });\n };\n\n onChoiceChanged = (index, choice) => {\n const { model, onModelChanged } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map((c) => merge({}, c, { correct: false }));\n }\n\n model.choices.splice(index, 1, choice);\n onModelChanged({\n choices: model.choices,\n });\n };\n\n onPromptChanged = (prompt) => {\n this.props.onModelChanged({\n prompt,\n });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n this.props.onModelChanged({\n teacherInstructions,\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map((c) => {\n if (correctFound) {\n c.correct = false;\n\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n\n return c;\n });\n }\n\n onModelChanged({\n choices: model.choices,\n }, true);\n break;\n }\n\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n const { configuration: { minAnswerChoices } = {} } = this.props;\n const { showWarning } = this.state;\n\n return (\n <React.Fragment>\n <AlertDialog\n open={showWarning}\n title=\"Warning\"\n text={`There can't be less than ${minAnswerChoices || 0} choices.`}\n onConfirm={() => this.setState({ showWarning: false })}\n />\n <Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n />\n </React.Fragment>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAQA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,IAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,KAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAEA,MAAM;EAAEa,KAAK;EAAEC,MAAM;EAAEC,KAAK;EAAEC;AAAS,CAAC,GAAGC,kBAAQ;AAEnD,MAAMC,WAAW,GAAG,CAAC;AAErB,MAAMC,YAAY,GAAG,IAAAC,cAAM,EAACC,wBAAc,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EAC1DC,KAAK,EAAE,MAAM;EACbC,UAAU,EAAEF,KAAK,CAACG,OAAO,CAAC,CAAC,CAAC;EAC5BC,YAAY,EAAEJ,KAAK,CAACG,OAAO,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,MAAME,eAAe,GAAG,IAAAP,cAAM,EAACC,wBAAc,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EAC7DM,IAAI,EAAE,CAAC;E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EAAE,IAAI,CAACA,WAAY;MAC9BH,eAAe,EAAE,IAAI,CAACA,eAAgB;MACtCQ,4BAA4B,EAAE,IAAI,CAACA;IAA6B,EACjE,CACa,CAAC;EAErB;AACF;AAACuI,OAAA,CAAA1B,IAAA,GAAAA,IAAA;AAAA,IAAAK,gBAAA,CAAAhD,OAAA,EAjJY2C,IAAI,eACI;EACjBvH,KAAK,EAAEkJ,kBAAS,CAACC,MAAM,CAACC,UAAU;EAClCnJ,aAAa,EAAEiJ,kBAAS,CAACC,MAAM,CAACC,UAAU;EAC1CC,gBAAgB,EAAEH,kBAAS,CAACI,IAAI;EAChCxB,cAAc,EAAEoB,kBAAS,CAACK,IAAI,CAACH,UAAU;EACzC3I,sBAAsB,EAAEyI,kBAAS,CAACK,IAAI,CAACH,UAAU;EACjD9I,YAAY,EAAE4I,kBAAS,CAACM,KAAK,CAAC;IAC5BC,GAAG,EAAEP,kBAAS,CAACK,IAAI,CAACH,UAAU;IAC9BM,MAAM,EAAER,kBAAS,CAACK,IAAI,CAACH;EACzB,CAAC;AACH,CAAC;AAAA,IAAAO,QAAA,GAAAV,OAAA,CAAArE,OAAA,GAwIY2C,IAAI","ignoreList":[]}
|
package/configure/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice-configure",
|
|
3
|
-
"version": "10.1.0-next.
|
|
3
|
+
"version": "10.1.0-next.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"@mui/icons-material": "^7.3.4",
|
|
11
11
|
"@mui/material": "^7.3.4",
|
|
12
12
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
13
|
-
"@pie-lib/config-ui": "13.0.
|
|
14
|
-
"@pie-lib/editable-html-tip-tap": "2.0.
|
|
15
|
-
"@pie-lib/render-ui": "6.0.
|
|
13
|
+
"@pie-lib/config-ui": "13.0.2-next.2",
|
|
14
|
+
"@pie-lib/editable-html-tip-tap": "2.1.0-next.2",
|
|
15
|
+
"@pie-lib/render-ui": "6.1.0-next.1",
|
|
16
16
|
"debug": "^4.1.1",
|
|
17
17
|
"lodash-es": "^4.17.23",
|
|
18
18
|
"prop-types": "^15.8.1",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.1.0-next.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@8.1.0-next.0...@pie-element/multiple-choice-controller@8.1.0-next.1) (2026-05-06)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- bump libs and shared modules PIE-440, PIE-436, PIE-439, PIE-519, PIE-216 ([932fc12](https://github.com/pie-framework/pie-elements/commit/932fc12557ba56a737cee005be898d54d5e590ef))
|
|
11
|
+
|
|
6
12
|
## [8.0.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@8.0.0...@pie-element/multiple-choice-controller@8.0.1) (2026-04-28)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @pie-element/multiple-choice-controller
|
package/controller/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice-controller",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "8.1.0-next.
|
|
4
|
+
"version": "8.1.0-next.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
8
8
|
"author": "",
|
|
9
9
|
"license": "ISC",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@pie-lib/controller-utils": "2.0.0",
|
|
11
|
+
"@pie-lib/controller-utils": "2.0.2-next.0",
|
|
12
12
|
"debug": "^4.1.1",
|
|
13
13
|
"lodash-es": "^4.17.23"
|
|
14
14
|
}
|
package/module/configure.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_dll_react as e,_dll_prop_types as t,_dll_mui__material_styles as n,_dll_pie_lib__render_ui as o,_dll_mui__material as i,_dll_mui__icons_material as r,_dll_debug as a,_dll_react_dom_client as s}from"../../../@pie-lib/shared-module@^5.0.2/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^4.0.2/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as c}from"../../../@pie-lib/editable-html-module@^7.0.2/module/index.js";var u={};Object.defineProperty(u,"__esModule",{value:!0});class d extends CustomEvent{constructor(e,t=!1){super(d.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}d.TYPE="model.updated";var h=u.ModelUpdatedEvent=d;class p extends CustomEvent{constructor(e,t){super(p.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}p.TYPE="delete.image";var g=u.DeleteImageEvent=p;class f extends CustomEvent{constructor(e){super(f.TYPE,{bubbles:!0,detail:e}),this.handler=e}}f.TYPE="insert.image";var b=u.InsertImageEvent=f;class m extends CustomEvent{constructor(e,t){super(m.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}m.TYPE="delete.sound";var _=u.DeleteSoundEvent=m;class y extends CustomEvent{constructor(e){super(y.TYPE,{bubbles:!0,detail:e}),this.handler=e}}y.TYPE="insert.sound";var C=u.InsertSoundEvent=y,v="object"==typeof global&&global&&global.Object===Object&&global,E="object"==typeof self&&self&&self.Object===Object&&self,j=v||E||Function("return this")(),A=j.Symbol,S=Object.prototype,x=S.hasOwnProperty,w=S.toString,O=A?A.toStringTag:void 0,P=Object.prototype.toString,I=A?A.toStringTag:void 0;function k(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":I&&I in Object(e)?function(e){var t=x.call(e,O),n=e[O];try{e[O]=void 0;var o=!0}catch(e){}var i=w.call(e);return o&&(t?e[O]=n:delete e[O]),i}(e):function(e){return P.call(e)}(e)}function M(e){return null!=e&&"object"==typeof e}var T=Array.isArray;function z(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function R(e){return e}function L(e){if(!z(e))return!1;var t=k(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var D,q=j["__core-js_shared__"],F=(D=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"",U=Function.prototype.toString,$=/^\[object .+?Constructor\]$/,B=Function.prototype,W=Object.prototype,Y=B.toString,H=W.hasOwnProperty,N=RegExp("^"+Y.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function G(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!z(e)||(t=e,F&&F in t))&&(L(e)?N:$).test(function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}(n)?n:void 0}var V,J,K,Q=Object.create,X=function(){function e(){}return function(t){if(!z(t))return{};if(Q)return Q(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Z=Date.now,ee=function(){try{var e=G(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),te=ee,ne=te?function(e,t){return te(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:R,oe=(V=ne,J=0,K=0,function(){var e=Z(),t=16-(e-K);if(K=e,t>0){if(++J>=800)return arguments[0]}else J=0;return V.apply(void 0,arguments)}),ie=/^(?:0|[1-9]\d*)$/;function re(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ie.test(e))&&e>-1&&e%1==0&&e<t}function ae(e,t,n){"__proto__"==t&&te?te(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function se(e,t){return e===t||e!=e&&t!=t}var le=Object.prototype.hasOwnProperty;function ce(e,t,n){var o=e[t];le.call(e,t)&&se(o,n)&&(void 0!==n||t in e)||ae(e,t,n)}var ue=Math.max;function de(e,t){return oe(function(e,t,n){return t=ue(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,r=ue(o.length-t,0),a=Array(r);++i<r;)a[i]=o[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=o[i];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,R),e+"")}function he(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function pe(e){return null!=e&&he(e.length)&&!L(e)}function ge(e,t,n){if(!z(n))return!1;var o=typeof t;return!!("number"==o?pe(n)&&re(t,n.length):"string"==o&&t in n)&&se(n[t],e)}var fe=Object.prototype;function be(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||fe)}function me(e){return M(e)&&"[object Arguments]"==k(e)}var _e=Object.prototype,ye=_e.hasOwnProperty,Ce=_e.propertyIsEnumerable,ve=me(function(){return arguments}())?me:function(e){return M(e)&&ye.call(e,"callee")&&!Ce.call(e,"callee")},Ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,je=Ee&&"object"==typeof module&&module&&!module.nodeType&&module,Ae=je&&je.exports===Ee?j.Buffer:void 0,Se=(Ae?Ae.isBuffer:void 0)||function(){return!1},xe={};xe["[object Float32Array]"]=xe["[object Float64Array]"]=xe["[object Int8Array]"]=xe["[object Int16Array]"]=xe["[object Int32Array]"]=xe["[object Uint8Array]"]=xe["[object Uint8ClampedArray]"]=xe["[object Uint16Array]"]=xe["[object Uint32Array]"]=!0,xe["[object Arguments]"]=xe["[object Array]"]=xe["[object ArrayBuffer]"]=xe["[object Boolean]"]=xe["[object DataView]"]=xe["[object Date]"]=xe["[object Error]"]=xe["[object Function]"]=xe["[object Map]"]=xe["[object Number]"]=xe["[object Object]"]=xe["[object RegExp]"]=xe["[object Set]"]=xe["[object String]"]=xe["[object WeakMap]"]=!1;var we="object"==typeof exports&&exports&&!exports.nodeType&&exports,Oe=we&&"object"==typeof module&&module&&!module.nodeType&&module,Pe=Oe&&Oe.exports===we&&v.process,Ie=function(){try{return Oe&&Oe.require&&Oe.require("util").types||Pe&&Pe.binding&&Pe.binding("util")}catch(e){}}(),ke=Ie&&Ie.isTypedArray,Me=ke?function(e){return function(t){return e(t)}}(ke):function(e){return M(e)&&he(e.length)&&!!xe[k(e)]},Te=Me,ze=Object.prototype.hasOwnProperty;var Re=Object.prototype.hasOwnProperty;function Le(e){return pe(e)?function(e,t){var n=T(e),o=!n&&ve(e),i=!n&&!o&&Se(e),r=!n&&!o&&!i&&Te(e),a=n||o||i||r,s=a?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],l=s.length;for(var c in e)!t&&!ze.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||re(c,l))||s.push(c);return s}(e,!0):function(e){if(!z(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=be(e),n=[];for(var o in e)("constructor"!=o||!t&&Re.call(e,o))&&n.push(o);return n}(e)}var De=G(Object,"create"),qe=Object.prototype.hasOwnProperty,Fe=Object.prototype.hasOwnProperty;function Ue(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function $e(e,t){for(var n=e.length;n--;)if(se(e[n][0],t))return n;return-1}Ue.prototype.clear=function(){this.__data__=De?De(null):{},this.size=0},Ue.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ue.prototype.get=function(e){var t=this.__data__;if(De){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return qe.call(t,e)?t[e]:void 0},Ue.prototype.has=function(e){var t=this.__data__;return De?void 0!==t[e]:Fe.call(t,e)},Ue.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=De&&void 0===t?"__lodash_hash_undefined__":t,this};var Be=Array.prototype.splice;function We(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}We.prototype.clear=function(){this.__data__=[],this.size=0},We.prototype.delete=function(e){var t=this.__data__,n=$e(t,e);return!(n<0||(n==t.length-1?t.pop():Be.call(t,n,1),--this.size,0))},We.prototype.get=function(e){var t=this.__data__,n=$e(t,e);return n<0?void 0:t[n][1]},We.prototype.has=function(e){return $e(this.__data__,e)>-1},We.prototype.set=function(e,t){var n=this.__data__,o=$e(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};var Ye=G(j,"Map");function He(e,t){var n,o,i=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Ne(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Ne.prototype.clear=function(){this.size=0,this.__data__={hash:new Ue,map:new(Ye||We),string:new Ue}},Ne.prototype.delete=function(e){var t=He(this,e).delete(e);return this.size-=t?1:0,t},Ne.prototype.get=function(e){return He(this,e).get(e)},Ne.prototype.has=function(e){return He(this,e).has(e)},Ne.prototype.set=function(e,t){var n=He(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};var Ge=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),Ve=Ge,Je=Function.prototype,Ke=Object.prototype,Qe=Je.toString,Xe=Ke.hasOwnProperty,Ze=Qe.call(Object);function et(e){var t=this.__data__=new We(e);this.size=t.size}et.prototype.clear=function(){this.__data__=new We,this.size=0},et.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},et.prototype.get=function(e){return this.__data__.get(e)},et.prototype.has=function(e){return this.__data__.has(e)},et.prototype.set=function(e,t){var n=this.__data__;if(n instanceof We){var o=n.__data__;if(!Ye||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ne(o)}return n.set(e,t),this.size=n.size,this};var tt="object"==typeof exports&&exports&&!exports.nodeType&&exports,nt=tt&&"object"==typeof module&&module&&!module.nodeType&&module,ot=nt&&nt.exports===tt?j.Buffer:void 0,it=(ot&&ot.allocUnsafe,j.Uint8Array);var rt=Object.prototype,at=rt.hasOwnProperty,st=de(function(e,t){e=Object(e);var n=-1,o=t.length,i=o>2?t[2]:void 0;for(i&&ge(t[0],t[1],i)&&(o=1);++n<o;)for(var r=t[n],a=Le(r),s=-1,l=a.length;++s<l;){var c=a[s],u=e[c];(void 0===u||se(u,rt[c])&&!at.call(e,c))&&(e[c]=r[c])}return e});function lt(e,t,n){(void 0!==n&&!se(e[t],n)||void 0===n&&!(t in e))&&ae(e,t,n)}function ct(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ut(e,t,n,o,i,r,a){var s=ct(e,n),l=ct(t,n),c=a.get(l);if(c)lt(e,n,c);else{var u,d=r?r(s,l,n+"",e,t,a):void 0,h=void 0===d;if(h){var p=T(l),g=!p&&Se(l),f=!p&&!g&&Te(l);d=l,p||g||f?T(s)?d=s:M(u=s)&&pe(u)?d=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n<o;)t[n]=e[n];return t}(s):g?(h=!1,d=function(e){return e.slice()}(l)):f?(h=!1,d=function(e,t){var n,o,i=t?(o=new(n=e.buffer).constructor(n.byteLength),new it(o).set(new it(n)),o):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(l,!0)):d=[]:function(e){if(!M(e)||"[object Object]"!=k(e))return!1;var t=Ve(e);if(null===t)return!0;var n=Xe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Qe.call(n)==Ze}(l)||ve(l)?(d=s,ve(s)?d=function(e){return function(e,t,n){var o=!n;n||(n={});for(var i=-1,r=t.length;++i<r;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),o?ae(n,a,s):ce(n,a,s)}return n}(e,Le(e))}(s):z(s)&&!L(s)||(d=function(e){return"function"!=typeof e.constructor||be(e)?{}:X(Ve(e))}(l))):h=!1}h&&(a.set(l,d),i(d,l,o,r,a),a.delete(l)),lt(e,n,d)}}function dt(e,t,n,o,i){e!==t&&function(e,t,n){for(var o=-1,i=Object(e),r=n(e),a=r.length;a--;){var s=r[++o];if(!1===t(i[s],s,i))break}}(t,function(r,a){if(i||(i=new et),z(r))ut(e,t,a,n,dt,o,i);else{var s=o?o(ct(e,a),r,a+"",e,t,i):void 0;void 0===s&&(s=r),lt(e,a,s)}},Le)}var ht,pt=(ht=function(e,t,n){dt(e,t,n)},de(function(e,t){var n=-1,o=t.length,i=o>1?t[o-1]:void 0,r=o>2?t[2]:void 0;for(i=ht.length>3&&"function"==typeof i?(o--,i):void 0,r&&ge(t[0],t[1],r)&&(i=o<3?void 0:i,o=1),e=Object(e);++n<o;){var a=t[n];a&&ht(e,a,n)}return e}));const gt=e,ft=t,{styled:bt}=n,{color:mt}=o,{Button:_t}=i,{Tooltip:yt}=i,{Typography:Ct}=i,{Box:vt}=i,{Info:Et}=r,jt=c,{AlertDialog:At}=l,{InputContainer:St}=l,{ChoiceConfiguration:xt}=l,{settings:wt}=l,{layout:Ot}=l,{choiceUtils:Pt}=l;function It(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const{Panel:kt,toggle:Mt,radio:Tt,dropdown:zt}=wt,Rt=bt(St)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),Lt=bt(St)(({theme:e})=>({flex:1,marginTop:e.spacing(1.5),paddingTop:e.spacing(2),marginLeft:e.spacing(3.5)})),Dt=bt(St)(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.spacing(1),width:"100%"})),qt=bt(_t)(({theme:e})=>({marginTop:e.spacing(1),float:"right"})),Ft=bt(qt)({cursor:"not-allowed",pointerEvents:"all",backgroundColor:mt.disabled(),"&:hover":{backgroundColor:mt.disabled()},"&:focus":{backgroundColor:mt.disabled()}}),Ut=bt(vt)({display:"flex",alignItems:"center"}),$t=bt(Ct)(({theme:e})=>({fontSize:e.typography.fontSize+2,marginRight:e.spacing(1)})),Bt=bt(yt)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})),Wt=bt("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)})),Yt=e=>{const{model:t,configuration:n,onPromptChanged:o,onChoiceChanged:i,onRemoveChoice:r,onAddChoice:a,imageSupport:s,uploadSoundSupport:l,onChangeModel:c,onConfigurationChanged:u,onTeacherInstructionsChanged:d}=e,{addChoiceButton:h={},contentDimensions:p={},feedback:g={},deleteChoice:f={},choiceMode:b={},choicePrefix:m={},partialScoring:_={},lockChoiceOrder:y={},teacherInstructions:C={},studentInstructions:v={},rationale:E={},scoringType:j={},sequentialChoiceLabels:A={},settingsPanelDisabled:S,choicesLayout:x,spellCheck:w={},gridColumns:O,maxImageWidth:P={},maxImageHeight:I={},prompt:k={},withRubric:M={},mathMlOptions:T={},language:z={},languageChoices:R={}}=n||{};let{maxAnswerChoices:L}=n||{};const{limitChoicesNumber:D,teacherInstructionsEnabled:q,rationaleEnabled:F,feedbackEnabled:U,promptEnabled:$,spellCheckEnabled:B,choices:W,errors:Y,toolbarEditorPosition:H,extraCSSRules:N}=t||{},{answerChoices:G,choices:V,correctResponse:J,prompt:K,rationale:Q,teacherInstructions:X}=Y||{},Z=It([W,"optionalAccess",e=>e.length])?Array.from({length:W.length},(e,t)=>`${t+1}`):[],{baseInputConfiguration:ee={}}=n,te={position:"top"===H?"top":"bottom"};D&&(L=9);const ne=(e={})=>({...ee,...e}),oe=(e=>{const{minAnswerChoices:t,maxAnswerChoices:n}=e;return`Validation requirements:\nThere should be at least ${t} `+(n?`and at most ${n} `:"")+"answer choices defined.\nEvery answer choice should be non-blank and unique.\nA correct answer must be defined."})(n),ie=P&&P.prompt,re=I&&I.prompt,ae=L&&It([W,"optionalAccess",e=>e.length])>=L?`Only ${L} allowed maximum`:"",se={choiceMode:b.settings&&Tt(b.label,["checkbox","radio"]),"sequentialChoiceLabels.enabled":A.settings&&Mt(A.label,!0),choicePrefix:m.settings&&Tt(m.label,["numbers","letters"]),partialScoring:_.settings&&Mt(_.label),lockChoiceOrder:y.settings&&Mt(y.label),feedbackEnabled:g.settings&&Mt(g.label),choicesLayout:x.settings&&zt(x.label,["vertical","grid","horizontal"]),gridColumns:x.settings&&"grid"===t.choicesLayout&&Z.length>0&&zt(O.label,Z),"language.enabled":z.settings&&Mt(z.label,!0),language:z.settings&&z.enabled&&zt(R.label,R.options)},le={teacherInstructionsEnabled:C.settings&&Mt(C.label),studentInstructionsEnabled:v.settings&&Mt(v.label),promptEnabled:k.settings&&Mt(k.label),rationaleEnabled:E.settings&&Mt(E.label),spellCheckEnabled:w.settings&&Mt(w.label),scoringType:j.settings&&Tt(j.label,["auto","rubric"]),rubricEnabled:It([M,"optionalAccess",e=>e.settings])&&Mt(It([M,"optionalAccess",e=>e.label]))};return gt.createElement(Ot.ConfigLayout,{dimensions:p,hideSettings:S,extraCSSRules:N,classes:{},settings:gt.createElement(kt,{model:t,onChangeModel:c,configuration:n,onChangeConfiguration:u,groups:{Settings:se,Properties:le}})},q&>.createElement(Rt,{label:C.label},gt.createElement(jt,{markup:t.teacherInstructions||"",onChange:d,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:X,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.teacherInstructions,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.teacherInstructions||ie,maxImageHeight:I&&I.teacherInstructions||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),X&>.createElement(Wt,null,X)),$&>.createElement(Rt,{label:k.label},gt.createElement(jt,{markup:t.prompt,onChange:o,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.prompt,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.prompt,maxImageHeight:I&&I.prompt,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),K&>.createElement(Wt,null,K)),gt.createElement(Ut,null,gt.createElement($t,{component:"div"},"Choices"),gt.createElement(Bt,{disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:oe},gt.createElement(Et,{fontSize:"small",color:"primary"}))),W.map((e,o)=>gt.createElement(Dt,{key:`choice-${o}`},gt.createElement(xt,{key:o,index:o+1,useLetterOrdering:"letters"===t.choicePrefix,mode:t.choiceMode,data:e,defaultFeedback:{},imageSupport:s,disableImageAlignmentButtons:!0,onDelete:()=>r(o),onChange:e=>i(o,e),allowFeedBack:U,allowDelete:f.settings,noLabels:!0,pluginOpts:ne(It([n,"optionalAccess",e=>e.choices,"optionalAccess",e=>e.inputConfiguration])),toolbarOpts:te,spellCheck:B,error:It([V,"optionalAccess",t=>t[e.value]])||null,noCorrectAnswerError:J,maxImageWidth:P&&P.choices||ie,maxImageHeight:I&&I.choices||re,uploadSoundSupport:l,mathMlOptions:T}),F&>.createElement(Lt,{key:`rationale-${o}`,label:E.label},gt.createElement(jt,{markup:e.rationale||"",onChange:t=>i(o,{...e,rationale:t}),imageSupport:s,error:It([Q,"optionalAccess",t=>t[e.value]])||null,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.rationale,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.rationale||ie,maxImageHeight:I&&I.rationale||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),It([Q,"optionalAccess",t=>t[e.value]])&>.createElement(Wt,null,It([Q,"optionalAccess",t=>t[e.value]]))))),J&>.createElement(Wt,null,J),G&>.createElement(Wt,null,G),h.settings&>.createElement(Bt,{title:ae},L&&It([W,"optionalAccess",e=>e.length])>=L?gt.createElement(Ft,{variant:"contained",color:"primary",onClick:a,disabled:!0},h.label):gt.createElement(qt,{variant:"contained",color:"primary",onClick:a},h.label)))};class Ht extends gt.Component{constructor(...e){super(...e),Ht.prototype.__init.call(this),Ht.prototype.__init2.call(this),Ht.prototype.__init3.call(this),Ht.prototype.__init4.call(this),Ht.prototype.__init5.call(this),Ht.prototype.__init6.call(this),Ht.prototype.__init7.call(this)}static __initStatic(){this.propTypes={model:ft.object.isRequired,configuration:ft.object.isRequired,disableSidePanel:ft.bool,onModelChanged:ft.func.isRequired,onConfigurationChanged:ft.func.isRequired,imageSupport:ft.shape({add:ft.func.isRequired,delete:ft.func.isRequired})}}__init(){this.state={showWarning:!1}}__init2(){this.onRemoveChoice=e=>{const{model:t,configuration:n,onModelChanged:o}=this.props,{minAnswerChoices:i}=n||{};i&&t.choices.length===i?this.setState({showWarning:!0}):(t.choices.splice(e,1),o(t))}}__init3(){this.onAddChoice=()=>{const{model:e,configuration:t,onModelChanged:n}=this.props;let{maxAnswerChoices:o}=t||{};const{limitChoicesNumber:i}=e||{};i&&(o=9),o&&e.choices.length>=o||(e.choices.push({label:"",value:Pt.firstAvailableIndex(e.choices.map(e=>e.value),0),feedback:{type:"none"}}),n(e))}}__init4(){this.onChoiceChanged=(e,t)=>{const{model:n,onModelChanged:o}=this.props;t.correct&&"radio"===n.choiceMode&&(n.choices=n.choices.map(e=>pt({},e,{correct:!1}))),n.choices.splice(e,1,t),o(n)}}__init5(){this.onPromptChanged=e=>{this.props.onModelChanged({...this.props.model,prompt:e})}}__init6(){this.onTeacherInstructionsChanged=e=>{this.props.onModelChanged({...this.props.model,teacherInstructions:e})}}__init7(){this.onModelChanged=(e,t)=>{const{onModelChanged:n}=this.props;if("choiceMode"===t){if("radio"===e.choiceMode){let t=!1;e.choices=e.choices.map(e=>t?(e.correct=!1,e):(e.correct&&(t=!0),e))}n(e,!0)}else n(e)}}render(){const{configuration:{minAnswerChoices:e}={}}=this.props,{showWarning:t}=this.state;return gt.createElement(gt.Fragment,null,gt.createElement(At,{open:t,title:"Warning",text:`There can't be less than ${e||0} choices.`,onConfirm:()=>this.setState({showWarning:!1})}),gt.createElement(Yt,{...this.props,onChangeModel:this.onModelChanged,onRemoveChoice:this.onRemoveChoice,onChoiceChanged:this.onChoiceChanged,onAddChoice:this.onAddChoice,onPromptChanged:this.onPromptChanged,onTeacherInstructionsChanged:this.onTeacherInstructionsChanged}))}}Ht.__initStatic();var Nt={choiceMode:"checkbox",choicePrefix:"letters",choices:[],choicesLayout:"vertical",feedbackEnabled:!1,gridColumns:2,lockChoiceOrder:!0,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",selectedAnswerBackgroundColor:"initial",keyboardEventsEnabled:!1},Gt={baseInputConfiguration:{h3:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},choices:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},choicesLayout:{settings:!1,label:"Choices Layout"},gridColumns:{label:"Grid columns"},answerChoiceCount:0,addChoiceButton:{settings:!0,label:"Add a Choice"},choiceMode:{settings:!0,label:"Response Type"},choicePrefix:{settings:!0,label:"Choice Labels"},deleteChoice:{settings:!0},feedback:{settings:!0,label:"Feedback"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},lockChoiceOrder:{settings:!0,label:"Lock Choice Order"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!1}},required:!1},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},toolbarEditorPosition:{settings:!1,label:"Toolbar Editor Position"},minAnswerChoices:2,maxAnswerChoices:5,maxImageWidth:{teacherInstructions:300,prompt:300,rationale:636,choices:900},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,choices:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const Vt=e,{createRoot:Jt}=s,Kt=a,{choiceUtils:Qt}=l;function Xt(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const Zt=Kt("multiple-choice:configure"),en=(e,t=0)=>{if(!e||0===e.length){let e=[];for(let n=0;n<t;n++)e.push({value:`${n}`,label:"",feedback:{type:"none",value:""}});return e}return e},tn=(e,t)=>{const n=st(e,Gt);return{configuration:n,model:{...t,choices:en(t&&t.choices||[],n&&n.answerChoiceCount)}}};class nn extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>{const t=Qt.normalizeChoices({...Nt,...e,choices:en(e&&e.choices||[])});return t.choicesLayout=e.choicesLayout||!1===e.verticalMode&&"horizontal"||Nt.choicesLayout,t}}constructor(){super(),this._root=null,this._reactContainer=null,this._model=nn.createDefaultModel(),this._configuration=Gt,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=nn.createDefaultModel(e),this._render()}set configuration(e){const t=tn(e,this._model);this.onModelChanged(t.model);const n={...Gt,...t.configuration};this._configuration=n,Xt([n,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Xt([n,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Xt([n,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):n.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find(e=>e.value===this._model.language)||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new h(this._model,t))}onModelChanged(e,t){this._model=e,this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=tn(e,this._model).configuration,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new b(e))}onDeleteImage(e,t){this.dispatchEvent(new g(e,t))}insertSound(e){this.dispatchEvent(new C(e))}onDeleteSound(e,t){this.dispatchEvent(new _(e,t))}_render(){Zt("_render - Starting render"),Zt("_render - Model:",this._model?"present":"missing"),Zt("_render - Configuration:",this._configuration?"present":"missing"),Zt("_render - Root exists:",!!this._root);try{let e=Vt.createElement(Ht,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(Zt("_render - Creating React container"),this._reactContainer=document.createElement("div"),this._reactContainer.className="pie-configure-wrapper",this.appendChild(this._reactContainer),Zt("_render - Creating new React root"),this._root=Jt(this._reactContainer),Zt("_render - React root created successfully")),Zt("_render - Calling root.render()"),this._root.render(e),Zt("_render - Render completed successfully")}catch(e){throw console.error("❌ [multiple-choice-configure] Render error:",e),console.error("Error stack:",e.stack),e}}connectedCallback(){Zt("connectedCallback - Component connected to DOM"),Zt("connectedCallback - Model:",this._model?"present":"missing"),Zt("connectedCallback - Configuration:",this._configuration?"present":"missing")}disconnectedCallback(){Zt("disconnectedCallback - Component disconnected from DOM"),this._root&&(Zt("disconnectedCallback - Unmounting React root"),this._root.unmount(),this._root=null),this._reactContainer&&(this._reactContainer=null)}}nn.__initStatic();export{nn as default};
|
|
1
|
+
import{_dll_react as e,_dll_prop_types as t,_dll_mui__material_styles as n,_dll_pie_lib__render_ui as o,_dll_mui__material as i,_dll_mui__icons_material as r,_dll_debug as a,_dll_react_dom_client as s}from"../../../@pie-lib/shared-module@^5.1.1/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^4.0.4/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as c}from"../../../@pie-lib/editable-html-module@^7.1.1/module/index.js";var u={};Object.defineProperty(u,"__esModule",{value:!0});class d extends CustomEvent{constructor(e,t=!1){super(d.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}d.TYPE="model.updated";var h=u.ModelUpdatedEvent=d;class p extends CustomEvent{constructor(e,t){super(p.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}p.TYPE="delete.image";var g=u.DeleteImageEvent=p;class f extends CustomEvent{constructor(e){super(f.TYPE,{bubbles:!0,detail:e}),this.handler=e}}f.TYPE="insert.image";var b=u.InsertImageEvent=f;class m extends CustomEvent{constructor(e,t){super(m.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}m.TYPE="delete.sound";var _=u.DeleteSoundEvent=m;class y extends CustomEvent{constructor(e){super(y.TYPE,{bubbles:!0,detail:e}),this.handler=e}}y.TYPE="insert.sound";var C=u.InsertSoundEvent=y,v="object"==typeof global&&global&&global.Object===Object&&global,E="object"==typeof self&&self&&self.Object===Object&&self,j=v||E||Function("return this")(),A=j.Symbol,S=Object.prototype,x=S.hasOwnProperty,w=S.toString,O=A?A.toStringTag:void 0,P=Object.prototype.toString,I=A?A.toStringTag:void 0;function k(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":I&&I in Object(e)?function(e){var t=x.call(e,O),n=e[O];try{e[O]=void 0;var o=!0}catch(e){}var i=w.call(e);return o&&(t?e[O]=n:delete e[O]),i}(e):function(e){return P.call(e)}(e)}function M(e){return null!=e&&"object"==typeof e}var T=Array.isArray;function z(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function R(e){return e}function L(e){if(!z(e))return!1;var t=k(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var D,q=j["__core-js_shared__"],F=(D=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"",U=Function.prototype.toString,$=/^\[object .+?Constructor\]$/,B=Function.prototype,W=Object.prototype,Y=B.toString,H=W.hasOwnProperty,N=RegExp("^"+Y.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function G(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!z(e)||(t=e,F&&F in t))&&(L(e)?N:$).test(function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}(n)?n:void 0}var V,J,K,Q=Object.create,X=function(){function e(){}return function(t){if(!z(t))return{};if(Q)return Q(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Z=Date.now,ee=function(){try{var e=G(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),te=ee,ne=te?function(e,t){return te(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:R,oe=(V=ne,J=0,K=0,function(){var e=Z(),t=16-(e-K);if(K=e,t>0){if(++J>=800)return arguments[0]}else J=0;return V.apply(void 0,arguments)}),ie=/^(?:0|[1-9]\d*)$/;function re(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ie.test(e))&&e>-1&&e%1==0&&e<t}function ae(e,t,n){"__proto__"==t&&te?te(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function se(e,t){return e===t||e!=e&&t!=t}var le=Object.prototype.hasOwnProperty;function ce(e,t,n){var o=e[t];le.call(e,t)&&se(o,n)&&(void 0!==n||t in e)||ae(e,t,n)}var ue=Math.max;function de(e,t){return oe(function(e,t,n){return t=ue(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,r=ue(o.length-t,0),a=Array(r);++i<r;)a[i]=o[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=o[i];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,R),e+"")}function he(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function pe(e){return null!=e&&he(e.length)&&!L(e)}function ge(e,t,n){if(!z(n))return!1;var o=typeof t;return!!("number"==o?pe(n)&&re(t,n.length):"string"==o&&t in n)&&se(n[t],e)}var fe=Object.prototype;function be(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||fe)}function me(e){return M(e)&&"[object Arguments]"==k(e)}var _e=Object.prototype,ye=_e.hasOwnProperty,Ce=_e.propertyIsEnumerable,ve=me(function(){return arguments}())?me:function(e){return M(e)&&ye.call(e,"callee")&&!Ce.call(e,"callee")},Ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,je=Ee&&"object"==typeof module&&module&&!module.nodeType&&module,Ae=je&&je.exports===Ee?j.Buffer:void 0,Se=(Ae?Ae.isBuffer:void 0)||function(){return!1},xe={};xe["[object Float32Array]"]=xe["[object Float64Array]"]=xe["[object Int8Array]"]=xe["[object Int16Array]"]=xe["[object Int32Array]"]=xe["[object Uint8Array]"]=xe["[object Uint8ClampedArray]"]=xe["[object Uint16Array]"]=xe["[object Uint32Array]"]=!0,xe["[object Arguments]"]=xe["[object Array]"]=xe["[object ArrayBuffer]"]=xe["[object Boolean]"]=xe["[object DataView]"]=xe["[object Date]"]=xe["[object Error]"]=xe["[object Function]"]=xe["[object Map]"]=xe["[object Number]"]=xe["[object Object]"]=xe["[object RegExp]"]=xe["[object Set]"]=xe["[object String]"]=xe["[object WeakMap]"]=!1;var we="object"==typeof exports&&exports&&!exports.nodeType&&exports,Oe=we&&"object"==typeof module&&module&&!module.nodeType&&module,Pe=Oe&&Oe.exports===we&&v.process,Ie=function(){try{return Oe&&Oe.require&&Oe.require("util").types||Pe&&Pe.binding&&Pe.binding("util")}catch(e){}}(),ke=Ie&&Ie.isTypedArray,Me=ke?function(e){return function(t){return e(t)}}(ke):function(e){return M(e)&&he(e.length)&&!!xe[k(e)]},Te=Me,ze=Object.prototype.hasOwnProperty;var Re=Object.prototype.hasOwnProperty;function Le(e){return pe(e)?function(e,t){var n=T(e),o=!n&&ve(e),i=!n&&!o&&Se(e),r=!n&&!o&&!i&&Te(e),a=n||o||i||r,s=a?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],l=s.length;for(var c in e)!t&&!ze.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||re(c,l))||s.push(c);return s}(e,!0):function(e){if(!z(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=be(e),n=[];for(var o in e)("constructor"!=o||!t&&Re.call(e,o))&&n.push(o);return n}(e)}var De=G(Object,"create"),qe=Object.prototype.hasOwnProperty,Fe=Object.prototype.hasOwnProperty;function Ue(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function $e(e,t){for(var n=e.length;n--;)if(se(e[n][0],t))return n;return-1}Ue.prototype.clear=function(){this.__data__=De?De(null):{},this.size=0},Ue.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ue.prototype.get=function(e){var t=this.__data__;if(De){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return qe.call(t,e)?t[e]:void 0},Ue.prototype.has=function(e){var t=this.__data__;return De?void 0!==t[e]:Fe.call(t,e)},Ue.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=De&&void 0===t?"__lodash_hash_undefined__":t,this};var Be=Array.prototype.splice;function We(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}We.prototype.clear=function(){this.__data__=[],this.size=0},We.prototype.delete=function(e){var t=this.__data__,n=$e(t,e);return!(n<0||(n==t.length-1?t.pop():Be.call(t,n,1),--this.size,0))},We.prototype.get=function(e){var t=this.__data__,n=$e(t,e);return n<0?void 0:t[n][1]},We.prototype.has=function(e){return $e(this.__data__,e)>-1},We.prototype.set=function(e,t){var n=this.__data__,o=$e(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};var Ye=G(j,"Map");function He(e,t){var n,o,i=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Ne(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Ne.prototype.clear=function(){this.size=0,this.__data__={hash:new Ue,map:new(Ye||We),string:new Ue}},Ne.prototype.delete=function(e){var t=He(this,e).delete(e);return this.size-=t?1:0,t},Ne.prototype.get=function(e){return He(this,e).get(e)},Ne.prototype.has=function(e){return He(this,e).has(e)},Ne.prototype.set=function(e,t){var n=He(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};var Ge=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),Ve=Ge,Je=Function.prototype,Ke=Object.prototype,Qe=Je.toString,Xe=Ke.hasOwnProperty,Ze=Qe.call(Object);function et(e){var t=this.__data__=new We(e);this.size=t.size}et.prototype.clear=function(){this.__data__=new We,this.size=0},et.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},et.prototype.get=function(e){return this.__data__.get(e)},et.prototype.has=function(e){return this.__data__.has(e)},et.prototype.set=function(e,t){var n=this.__data__;if(n instanceof We){var o=n.__data__;if(!Ye||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ne(o)}return n.set(e,t),this.size=n.size,this};var tt="object"==typeof exports&&exports&&!exports.nodeType&&exports,nt=tt&&"object"==typeof module&&module&&!module.nodeType&&module,ot=nt&&nt.exports===tt?j.Buffer:void 0,it=(ot&&ot.allocUnsafe,j.Uint8Array);var rt=Object.prototype,at=rt.hasOwnProperty,st=de(function(e,t){e=Object(e);var n=-1,o=t.length,i=o>2?t[2]:void 0;for(i&&ge(t[0],t[1],i)&&(o=1);++n<o;)for(var r=t[n],a=Le(r),s=-1,l=a.length;++s<l;){var c=a[s],u=e[c];(void 0===u||se(u,rt[c])&&!at.call(e,c))&&(e[c]=r[c])}return e});function lt(e,t,n){(void 0!==n&&!se(e[t],n)||void 0===n&&!(t in e))&&ae(e,t,n)}function ct(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ut(e,t,n,o,i,r,a){var s=ct(e,n),l=ct(t,n),c=a.get(l);if(c)lt(e,n,c);else{var u,d=r?r(s,l,n+"",e,t,a):void 0,h=void 0===d;if(h){var p=T(l),g=!p&&Se(l),f=!p&&!g&&Te(l);d=l,p||g||f?T(s)?d=s:M(u=s)&&pe(u)?d=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n<o;)t[n]=e[n];return t}(s):g?(h=!1,d=function(e){return e.slice()}(l)):f?(h=!1,d=function(e,t){var n,o,i=t?(o=new(n=e.buffer).constructor(n.byteLength),new it(o).set(new it(n)),o):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(l,!0)):d=[]:function(e){if(!M(e)||"[object Object]"!=k(e))return!1;var t=Ve(e);if(null===t)return!0;var n=Xe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Qe.call(n)==Ze}(l)||ve(l)?(d=s,ve(s)?d=function(e){return function(e,t,n){var o=!n;n||(n={});for(var i=-1,r=t.length;++i<r;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),o?ae(n,a,s):ce(n,a,s)}return n}(e,Le(e))}(s):z(s)&&!L(s)||(d=function(e){return"function"!=typeof e.constructor||be(e)?{}:X(Ve(e))}(l))):h=!1}h&&(a.set(l,d),i(d,l,o,r,a),a.delete(l)),lt(e,n,d)}}function dt(e,t,n,o,i){e!==t&&function(e,t,n){for(var o=-1,i=Object(e),r=n(e),a=r.length;a--;){var s=r[++o];if(!1===t(i[s],s,i))break}}(t,function(r,a){if(i||(i=new et),z(r))ut(e,t,a,n,dt,o,i);else{var s=o?o(ct(e,a),r,a+"",e,t,i):void 0;void 0===s&&(s=r),lt(e,a,s)}},Le)}var ht,pt=(ht=function(e,t,n){dt(e,t,n)},de(function(e,t){var n=-1,o=t.length,i=o>1?t[o-1]:void 0,r=o>2?t[2]:void 0;for(i=ht.length>3&&"function"==typeof i?(o--,i):void 0,r&&ge(t[0],t[1],r)&&(i=o<3?void 0:i,o=1),e=Object(e);++n<o;){var a=t[n];a&&ht(e,a,n)}return e}));const gt=e,ft=t,{styled:bt}=n,{color:mt}=o,{Button:_t}=i,{Tooltip:yt}=i,{Typography:Ct}=i,{Box:vt}=i,{Info:Et}=r,jt=c,{AlertDialog:At}=l,{InputContainer:St}=l,{ChoiceConfiguration:xt}=l,{settings:wt}=l,{layout:Ot}=l,{choiceUtils:Pt}=l;function It(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const{Panel:kt,toggle:Mt,radio:Tt,dropdown:zt}=wt,Rt=bt(St)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),Lt=bt(St)(({theme:e})=>({flex:1,marginTop:e.spacing(1.5),paddingTop:e.spacing(2),marginLeft:e.spacing(3.5)})),Dt=bt(St)(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.spacing(1),width:"100%"})),qt=bt(_t)(({theme:e})=>({marginTop:e.spacing(1),float:"right"})),Ft=bt(qt)({cursor:"not-allowed",pointerEvents:"all",backgroundColor:mt.disabled(),"&:hover":{backgroundColor:mt.disabled()},"&:focus":{backgroundColor:mt.disabled()}}),Ut=bt(vt)({display:"flex",alignItems:"center"}),$t=bt(Ct)(({theme:e})=>({fontSize:e.typography.fontSize+2,marginRight:e.spacing(1)})),Bt=bt(yt)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})),Wt=bt("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)})),Yt=e=>{const{model:t,configuration:n,onPromptChanged:o,onChoiceChanged:i,onRemoveChoice:r,onAddChoice:a,imageSupport:s,uploadSoundSupport:l,onChangeModel:c,onConfigurationChanged:u,onTeacherInstructionsChanged:d}=e,{addChoiceButton:h={},contentDimensions:p={},feedback:g={},deleteChoice:f={},choiceMode:b={},choicePrefix:m={},partialScoring:_={},lockChoiceOrder:y={},teacherInstructions:C={},studentInstructions:v={},rationale:E={},scoringType:j={},sequentialChoiceLabels:A={},settingsPanelDisabled:S,choicesLayout:x,spellCheck:w={},gridColumns:O,maxImageWidth:P={},maxImageHeight:I={},prompt:k={},withRubric:M={},mathMlOptions:T={},language:z={},languageChoices:R={}}=n||{};let{maxAnswerChoices:L}=n||{};const{limitChoicesNumber:D,teacherInstructionsEnabled:q,rationaleEnabled:F,feedbackEnabled:U,promptEnabled:$,spellCheckEnabled:B,choices:W,errors:Y,toolbarEditorPosition:H,extraCSSRules:N}=t||{},{answerChoices:G,choices:V,correctResponse:J,prompt:K,rationale:Q,teacherInstructions:X}=Y||{},Z=It([W,"optionalAccess",e=>e.length])?Array.from({length:W.length},(e,t)=>`${t+1}`):[],{baseInputConfiguration:ee={}}=n,te={position:"top"===H?"top":"bottom"};D&&(L=9);const ne=(e={})=>({...ee,...e}),oe=(e=>{const{minAnswerChoices:t,maxAnswerChoices:n}=e;return`Validation requirements:\nThere should be at least ${t} `+(n?`and at most ${n} `:"")+"answer choices defined.\nEvery answer choice should be non-blank and unique.\nA correct answer must be defined."})(n),ie=P&&P.prompt,re=I&&I.prompt,ae=L&&It([W,"optionalAccess",e=>e.length])>=L?`Only ${L} allowed maximum`:"",se={choiceMode:b.settings&&Tt(b.label,["checkbox","radio"]),"sequentialChoiceLabels.enabled":A.settings&&Mt(A.label,!0),choicePrefix:m.settings&&Tt(m.label,["numbers","letters"]),partialScoring:_.settings&&Mt(_.label),lockChoiceOrder:y.settings&&Mt(y.label),feedbackEnabled:g.settings&&Mt(g.label),choicesLayout:x.settings&&zt(x.label,["vertical","grid","horizontal"]),gridColumns:x.settings&&"grid"===t.choicesLayout&&Z.length>0&&zt(O.label,Z),"language.enabled":z.settings&&Mt(z.label,!0),language:z.settings&&z.enabled&&zt(R.label,R.options)},le={teacherInstructionsEnabled:C.settings&&Mt(C.label),studentInstructionsEnabled:v.settings&&Mt(v.label),promptEnabled:k.settings&&Mt(k.label),rationaleEnabled:E.settings&&Mt(E.label),spellCheckEnabled:w.settings&&Mt(w.label),scoringType:j.settings&&Tt(j.label,["auto","rubric"]),rubricEnabled:It([M,"optionalAccess",e=>e.settings])&&Mt(It([M,"optionalAccess",e=>e.label]))};return gt.createElement(Ot.ConfigLayout,{dimensions:p,hideSettings:S,extraCSSRules:N,classes:{},settings:gt.createElement(kt,{model:t,onChangeModel:c,configuration:n,onChangeConfiguration:u,groups:{Settings:se,Properties:le}})},q&>.createElement(Rt,{label:C.label},gt.createElement(jt,{markup:t.teacherInstructions||"",onChange:d,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:X,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.teacherInstructions,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.teacherInstructions||ie,maxImageHeight:I&&I.teacherInstructions||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),X&>.createElement(Wt,null,X)),$&>.createElement(Rt,{label:k.label},gt.createElement(jt,{markup:t.prompt,onChange:o,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.prompt,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.prompt,maxImageHeight:I&&I.prompt,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),K&>.createElement(Wt,null,K)),gt.createElement(Ut,null,gt.createElement($t,{component:"div"},"Choices"),gt.createElement(Bt,{disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:oe},gt.createElement(Et,{fontSize:"small",color:"primary"}))),W.map((e,o)=>gt.createElement(Dt,{key:`choice-${o}`},gt.createElement(xt,{key:o,index:o+1,useLetterOrdering:"letters"===t.choicePrefix,mode:t.choiceMode,data:e,defaultFeedback:{},imageSupport:s,disableImageAlignmentButtons:!0,onDelete:()=>r(o),onChange:e=>i(o,e),allowFeedBack:U,allowDelete:f.settings,noLabels:!0,pluginOpts:ne(It([n,"optionalAccess",e=>e.choices,"optionalAccess",e=>e.inputConfiguration])),toolbarOpts:te,spellCheck:B,error:It([V,"optionalAccess",t=>t[e.value]])||null,noCorrectAnswerError:J,maxImageWidth:P&&P.choices||ie,maxImageHeight:I&&I.choices||re,uploadSoundSupport:l,mathMlOptions:T}),F&>.createElement(Lt,{key:`rationale-${o}`,label:E.label},gt.createElement(jt,{markup:e.rationale||"",onChange:t=>i(o,{...e,rationale:t}),imageSupport:s,error:It([Q,"optionalAccess",t=>t[e.value]])||null,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.rationale,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.rationale||ie,maxImageHeight:I&&I.rationale||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),It([Q,"optionalAccess",t=>t[e.value]])&>.createElement(Wt,null,It([Q,"optionalAccess",t=>t[e.value]]))))),J&>.createElement(Wt,null,J),G&>.createElement(Wt,null,G),h.settings&>.createElement(Bt,{title:ae},L&&It([W,"optionalAccess",e=>e.length])>=L?gt.createElement(Ft,{variant:"contained",color:"primary",onClick:a,disabled:!0},h.label):gt.createElement(qt,{variant:"contained",color:"primary",onClick:a},h.label)))};class Ht extends gt.Component{constructor(...e){super(...e),Ht.prototype.__init.call(this),Ht.prototype.__init2.call(this),Ht.prototype.__init3.call(this),Ht.prototype.__init4.call(this),Ht.prototype.__init5.call(this),Ht.prototype.__init6.call(this),Ht.prototype.__init7.call(this)}static __initStatic(){this.propTypes={model:ft.object.isRequired,configuration:ft.object.isRequired,disableSidePanel:ft.bool,onModelChanged:ft.func.isRequired,onConfigurationChanged:ft.func.isRequired,imageSupport:ft.shape({add:ft.func.isRequired,delete:ft.func.isRequired})}}__init(){this.state={showWarning:!1}}__init2(){this.onRemoveChoice=e=>{const{model:t,configuration:n,onModelChanged:o}=this.props,{minAnswerChoices:i}=n||{};i&&t.choices.length===i?this.setState({showWarning:!0}):(t.choices.splice(e,1),o({choices:t.choices}))}}__init3(){this.onAddChoice=()=>{const{model:e,configuration:t,onModelChanged:n}=this.props;let{maxAnswerChoices:o}=t||{};const{limitChoicesNumber:i}=e||{};i&&(o=9),o&&e.choices.length>=o||(e.choices.push({label:"",value:Pt.firstAvailableIndex(e.choices.map(e=>e.value),0),feedback:{type:"none"}}),n({choices:e.choices}))}}__init4(){this.onChoiceChanged=(e,t)=>{const{model:n,onModelChanged:o}=this.props;t.correct&&"radio"===n.choiceMode&&(n.choices=n.choices.map(e=>pt({},e,{correct:!1}))),n.choices.splice(e,1,t),o({choices:n.choices})}}__init5(){this.onPromptChanged=e=>{this.props.onModelChanged({prompt:e})}}__init6(){this.onTeacherInstructionsChanged=e=>{this.props.onModelChanged({teacherInstructions:e})}}__init7(){this.onModelChanged=(e,t)=>{const{onModelChanged:n}=this.props;if("choiceMode"===t){if("radio"===e.choiceMode){let t=!1;e.choices=e.choices.map(e=>t?(e.correct=!1,e):(e.correct&&(t=!0),e))}n({choices:e.choices},!0)}else n(e)}}render(){const{configuration:{minAnswerChoices:e}={}}=this.props,{showWarning:t}=this.state;return gt.createElement(gt.Fragment,null,gt.createElement(At,{open:t,title:"Warning",text:`There can't be less than ${e||0} choices.`,onConfirm:()=>this.setState({showWarning:!1})}),gt.createElement(Yt,{...this.props,onChangeModel:this.onModelChanged,onRemoveChoice:this.onRemoveChoice,onChoiceChanged:this.onChoiceChanged,onAddChoice:this.onAddChoice,onPromptChanged:this.onPromptChanged,onTeacherInstructionsChanged:this.onTeacherInstructionsChanged}))}}Ht.__initStatic();var Nt={choiceMode:"checkbox",choicePrefix:"letters",choices:[],choicesLayout:"vertical",feedbackEnabled:!1,gridColumns:2,lockChoiceOrder:!0,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",selectedAnswerBackgroundColor:"initial",keyboardEventsEnabled:!1},Gt={baseInputConfiguration:{h3:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},choices:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},choicesLayout:{settings:!1,label:"Choices Layout"},gridColumns:{label:"Grid columns"},answerChoiceCount:0,addChoiceButton:{settings:!0,label:"Add a Choice"},choiceMode:{settings:!0,label:"Response Type"},choicePrefix:{settings:!0,label:"Choice Labels"},deleteChoice:{settings:!0},feedback:{settings:!0,label:"Feedback"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},lockChoiceOrder:{settings:!0,label:"Lock Choice Order"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!1}},required:!1},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},toolbarEditorPosition:{settings:!1,label:"Toolbar Editor Position"},minAnswerChoices:2,maxAnswerChoices:5,maxImageWidth:{teacherInstructions:300,prompt:300,rationale:636,choices:900},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,choices:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const Vt=e,{createRoot:Jt}=s,Kt=a,{choiceUtils:Qt}=l;function Xt(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const Zt=Kt("multiple-choice:configure"),en=(e,t=0)=>{if(!e||0===e.length){let e=[];for(let n=0;n<t;n++)e.push({value:`${n}`,label:"",feedback:{type:"none",value:""}});return e}return e},tn=(e,t)=>{const n=st(e,Gt);return{configuration:n,model:{...t,choices:en(t&&t.choices||[],n&&n.answerChoiceCount)}}};class nn extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>{const t=Qt.normalizeChoices({...Nt,...e,choices:en(e&&e.choices||[])});return t.choicesLayout=e.choicesLayout||!1===e.verticalMode&&"horizontal"||Nt.choicesLayout,t}}constructor(){super(),this._root=null,this._reactContainer=null,this._model=nn.createDefaultModel(),this._configuration=Gt,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=nn.createDefaultModel(e),this._render()}set configuration(e){const t=tn(e,this._model);this.onModelChanged(t.model);const n={...Gt,...t.configuration};this._configuration=n,Xt([n,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Xt([n,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Xt([n,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):n.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find(e=>e.value===this._model.language)||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new h(this._model,t))}onModelChanged(e,t){this._model={...this._model,...e},this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=tn(e,this._model).configuration,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new b(e))}onDeleteImage(e,t){this.dispatchEvent(new g(e,t))}insertSound(e){this.dispatchEvent(new C(e))}onDeleteSound(e,t){this.dispatchEvent(new _(e,t))}_render(){Zt("_render - Starting render"),Zt("_render - Model:",this._model?"present":"missing"),Zt("_render - Configuration:",this._configuration?"present":"missing"),Zt("_render - Root exists:",!!this._root);try{let e=Vt.createElement(Ht,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(Zt("_render - Creating React container"),this._reactContainer=document.createElement("div"),this._reactContainer.className="pie-configure-wrapper",this.appendChild(this._reactContainer),Zt("_render - Creating new React root"),this._root=Jt(this._reactContainer),Zt("_render - React root created successfully")),Zt("_render - Calling root.render()"),this._root.render(e),Zt("_render - Render completed successfully")}catch(e){throw console.error("❌ [multiple-choice-configure] Render error:",e),console.error("Error stack:",e.stack),e}}connectedCallback(){Zt("connectedCallback - Component connected to DOM"),Zt("connectedCallback - Model:",this._model?"present":"missing"),Zt("connectedCallback - Configuration:",this._configuration?"present":"missing")}disconnectedCallback(){Zt("disconnectedCallback - Component disconnected from DOM"),this._root&&(Zt("disconnectedCallback - Unmounting React root"),this._root.unmount(),this._root=null),this._reactContainer&&(this._reactContainer=null)}}nn.__initStatic();export{nn as default};
|