@pie-element/explicit-constructed-response 7.2.10-next.0 → 7.2.10-next.5
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/configure/lib/index.js +5 -11
- package/configure/lib/index.js.map +1 -1
- package/module/configure.js +6 -11
- package/module/element.js +1 -1
- package/module/manifest.json +1 -1
- package/module/print.js +1 -1
- package/package.json +2 -2
package/configure/lib/index.js
CHANGED
|
@@ -146,20 +146,14 @@ var ExplicitConstructedResponse = /*#__PURE__*/function (_HTMLElement) {
|
|
|
146
146
|
}, {
|
|
147
147
|
key: "onConfigurationChanged",
|
|
148
148
|
value: function onConfigurationChanged(c) {
|
|
149
|
-
var _this$
|
|
149
|
+
var _this$_configuration, _this$_configuration$2;
|
|
150
150
|
|
|
151
|
-
var previousInputConfig = (_this$_model = this._model) === null || _this$_model === void 0 ? void 0 : _this$_model.responseAreaInputConfiguration;
|
|
152
151
|
this._configuration = c;
|
|
153
152
|
var newInputConfig = (_this$_configuration = this._configuration) === null || _this$_configuration === void 0 ? void 0 : (_this$_configuration$2 = _this$_configuration.responseAreaInputConfiguration) === null || _this$_configuration$2 === void 0 ? void 0 : _this$_configuration$2.inputConfiguration;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
});
|
|
159
|
-
this.onModelChanged(this._model);
|
|
160
|
-
} else {
|
|
161
|
-
this._render();
|
|
162
|
-
}
|
|
153
|
+
this._model = _objectSpread(_objectSpread({}, this._model), {}, {
|
|
154
|
+
responseAreaInputConfiguration: newInputConfig
|
|
155
|
+
});
|
|
156
|
+
this.onModelChanged(this._model);
|
|
163
157
|
}
|
|
164
158
|
/** @param {done, progress, file} handler */
|
|
165
159
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","ExplicitConstructedResponse","_model","prepareModel","_configuration","sensibleDefaults","configuration","onModelChanged","bind","onConfigurationChanged","s","responseAreaInputConfiguration","inputConfiguration","_render","c","language","enabled","languageChoices","options","length","value","settings","find","option","push","label","_disableSidePanel","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","dispatchModelUpdated","previousInputConfig","newInputConfig","handler","InsertImageEvent","src","done","DeleteImageEvent","InsertSoundEvent","DeleteSoundEvent","element","React","createElement","Main","model","disableSidePanel","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","render","HTMLElement","joinedObj","slateMarkup","markup","choices","processedMarkup","Object","keys","forEach","key","map","item","index"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,yCAAN,CAAZ;;IAEqBC,2B;;;;;AAiCnB,yCAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAcD,2BAA2B,CAACE,YAA5B,EAAd;AACA,UAAKC,cAAL,GAAsBC,sBAAiBC,aAAvC;AACA,UAAKC,cAAL,GAAsB,MAAKA,cAAL,CAAoBC,IAApB,gDAAtB;AACA,UAAKC,sBAAL,GAA8B,MAAKA,sBAAL,CAA4BD,IAA5B,gDAA9B;AALY;AAMb;;;;SAED,aAAUE,CAAV,EAAa;AACX,WAAKR,MAAL,GAAcD,2BAA2B,CAACE,YAA5B,CAAyCO,CAAzC,CAAd;;AACA,UAAI,KAAKR,MAAL,CAAYS,8BAAhB,EAAgD;AAAA;;AAC9C,aAAKT,MAAL,CAAYS,8BAAZ,4BAA6C,KAAKP,cAAL,CAAoBO,8BAAjE,0DAA6C,sBAAoDC,kBAAjG;AACD;;AACD,WAAKC,OAAL;AACD;;;SAED,aAAkBC,CAAlB,EAAqB;AAAA;AAAA;;AACnB,WAAKV,cAAL,GAAsB,0BAASU,CAAT,EAAYT,sBAAiBC,aAA7B,CAAtB,CADmB,CAGnB;AACA;AACA;AACA;;AACA,yBAAIQ,CAAC,CAACC,Q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R,SAAS,CAACG,OAAV,CAAkBK,GAAlB,CAAR,CAAJ,EAAqC;AACnCR,QAAAA,SAAS,CAACG,OAAV,CAAkBK,GAAlB,IAAyB,CAACR,SAAS,CAACG,OAAV,CAAkBK,GAAlB,KAA0B,EAA3B,EAA+BC,GAA/B,CAAmC,UAACC,IAAD,EAAOC,KAAP,EAAiB;AAC3E,cAAI,CAACD,IAAI,CAAChD,KAAV,EAAiB;AACfpB,YAAAA,GAAG,CAAC,8DAAD,EAAiEoE,IAAjE,CAAH;AACA;AAAShD,cAAAA,KAAK,YAAKiD,KAAL;AAAd,eAA+BD,IAA/B;AACD;;AAED,iBAAOA,IAAP;AACD,SAPwB,CAAzB;AAQD;AACF,KAXD;AAYD;;AAED,yCACKV,SADL;AAEEC,IAAAA,WAAW,EAAXA,WAFF;AAGEC,IAAAA,MAAM,EAAEE;AAHV;AAKD,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\nimport defaults from 'lodash/defaults';\nimport isArray from 'lodash/isArray';\nimport {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\n\nimport sensibleDefaults from './defaults';\nimport { processMarkup, createSlateMarkup } from './markupUtils';\n\nconst log = debug('explicit-constructed-response:configure');\n\nexport default class ExplicitConstructedResponse extends HTMLElement {\n static prepareModel = (model = {}) => {\n const joinedObj = {\n ...sensibleDefaults.model,\n ...model,\n };\n const slateMarkup = joinedObj.slateMarkup || createSlateMarkup(joinedObj.markup, joinedObj.choices);\n const processedMarkup = processMarkup(slateMarkup);\n\n // this was added to treat an exception, when the model has choices without the \"value\" property\n // like: { label: 'test' }\n if (joinedObj.choices) {\n Object.keys(joinedObj.choices).forEach((key) => {\n if (isArray(joinedObj.choices[key])) {\n joinedObj.choices[key] = (joinedObj.choices[key] || []).map((item, index) => {\n if (!item.value) {\n log('Choice does not contain \"value\" property, which is required.', item);\n return { value: `${index}`, ...item };\n }\n\n return item;\n });\n }\n });\n }\n\n return {\n ...joinedObj,\n slateMarkup,\n markup: processedMarkup,\n };\n };\n\n constructor() {\n super();\n this._model = ExplicitConstructedResponse.prepareModel();\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 = ExplicitConstructedResponse.prepareModel(s);\n if (this._model.responseAreaInputConfiguration) {\n this._model.responseAreaInputConfiguration = this._configuration.responseAreaInputConfiguration?.inputConfiguration;\n }\n this._render();\n }\n\n set configuration(c) {\n this._configuration = defaults(c, sensibleDefaults.configuration);\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 (c.language?.enabled) {\n if (c.languageChoices?.options?.length) {\n this._model.language = c.languageChoices.options[0].value;\n }\n } else if (c.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 = ExplicitConstructedResponse.prepareModel(m);\n this._render();\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n const previousInputConfig = this._model?.responseAreaInputConfiguration;\n\n this._configuration = c;\n\n const newInputConfig = this._configuration?.responseAreaInputConfiguration?.inputConfiguration;\n\n if (previousInputConfig !== newInputConfig) {\n this._model = {\n ...this._model,\n responseAreaInputConfiguration: newInputConfig\n };\n\n this.onModelChanged(this._model);\n\n } else {\n this._render();\n }\n }\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');\n\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 ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","ExplicitConstructedResponse","_model","prepareModel","_configuration","sensibleDefaults","configuration","onModelChanged","bind","onConfigurationChanged","s","responseAreaInputConfiguration","inputConfiguration","_render","c","language","enabled","languageChoices","options","length","value","settings","find","option","push","label","_disableSidePanel","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","dispatchModelUpdated","newInputConfig","handler","InsertImageEvent","src","done","DeleteImageEvent","InsertSoundEvent","DeleteSoundEvent","element","React","createElement","Main","model","disableSidePanel","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","render","HTMLElement","joinedObj","slateMarkup","markup","choices","processedMarkup","Object","keys","forEach","key","map","item","index"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;A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C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\nimport defaults from 'lodash/defaults';\nimport isArray from 'lodash/isArray';\nimport {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\n\nimport sensibleDefaults from './defaults';\nimport { processMarkup, createSlateMarkup } from './markupUtils';\n\nconst log = debug('explicit-constructed-response:configure');\n\nexport default class ExplicitConstructedResponse extends HTMLElement {\n static prepareModel = (model = {}) => {\n const joinedObj = {\n ...sensibleDefaults.model,\n ...model,\n };\n const slateMarkup = joinedObj.slateMarkup || createSlateMarkup(joinedObj.markup, joinedObj.choices);\n const processedMarkup = processMarkup(slateMarkup);\n\n // this was added to treat an exception, when the model has choices without the \"value\" property\n // like: { label: 'test' }\n if (joinedObj.choices) {\n Object.keys(joinedObj.choices).forEach((key) => {\n if (isArray(joinedObj.choices[key])) {\n joinedObj.choices[key] = (joinedObj.choices[key] || []).map((item, index) => {\n if (!item.value) {\n log('Choice does not contain \"value\" property, which is required.', item);\n return { value: `${index}`, ...item };\n }\n\n return item;\n });\n }\n });\n }\n\n return {\n ...joinedObj,\n slateMarkup,\n markup: processedMarkup,\n };\n };\n\n constructor() {\n super();\n this._model = ExplicitConstructedResponse.prepareModel();\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 = ExplicitConstructedResponse.prepareModel(s);\n if (this._model.responseAreaInputConfiguration) {\n this._model.responseAreaInputConfiguration = this._configuration.responseAreaInputConfiguration?.inputConfiguration;\n }\n this._render();\n }\n\n set configuration(c) {\n this._configuration = defaults(c, sensibleDefaults.configuration);\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 (c.language?.enabled) {\n if (c.languageChoices?.options?.length) {\n this._model.language = c.languageChoices.options[0].value;\n }\n } else if (c.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 = ExplicitConstructedResponse.prepareModel(m);\n this._render();\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = c;\n\n const newInputConfig = this._configuration?.responseAreaInputConfiguration?.inputConfiguration;\n\n this._model = {\n ...this._model,\n responseAreaInputConfiguration: newInputConfig\n };\n\n this.onModelChanged(this._model);\n }\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');\n\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 ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|
package/module/configure.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.0
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.1.0/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.7.2/module/index.js";
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
function getDefaultExportFromCjs(x) {
|
|
@@ -17121,18 +17121,13 @@ const {isArray: require$$13} = _dll_lodash;
|
|
|
17121
17121
|
}, {
|
|
17122
17122
|
key: "onConfigurationChanged",
|
|
17123
17123
|
value: function onConfigurationChanged(c) {
|
|
17124
|
-
var _this$
|
|
17125
|
-
var previousInputConfig = (_this$_model = this._model) === null || _this$_model === void 0 ? void 0 : _this$_model.responseAreaInputConfiguration;
|
|
17124
|
+
var _this$_configuration, _this$_configuration$2;
|
|
17126
17125
|
this._configuration = c;
|
|
17127
17126
|
var newInputConfig = (_this$_configuration = this._configuration) === null || _this$_configuration === void 0 ? void 0 : (_this$_configuration$2 = _this$_configuration.responseAreaInputConfiguration) === null || _this$_configuration$2 === void 0 ? void 0 : _this$_configuration$2.inputConfiguration;
|
|
17128
|
-
|
|
17129
|
-
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
this.onModelChanged(this._model);
|
|
17133
|
-
} else {
|
|
17134
|
-
this._render();
|
|
17135
|
-
}
|
|
17127
|
+
this._model = _objectSpread(_objectSpread({}, this._model), {}, {
|
|
17128
|
+
responseAreaInputConfiguration: newInputConfig
|
|
17129
|
+
});
|
|
17130
|
+
this.onModelChanged(this._model);
|
|
17136
17131
|
}
|
|
17137
17132
|
}, {
|
|
17138
17133
|
key: "insertImage",
|
package/module/element.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.0
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.1.0/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.7.2/module/index.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
package/module/manifest.json
CHANGED
package/module/print.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.0
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.1.0/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.7.2/module/index.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "7.2.10-next.
|
|
7
|
+
"version": "7.2.10-next.5+75922d067",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"postpublish": "../../scripts/postpublish"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "ISC",
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "75922d0676250f6d5714747c7191cef245bbb1ff",
|
|
25
25
|
"main": "lib/index.js",
|
|
26
26
|
"module": "src/index.js",
|
|
27
27
|
"exports": {
|