@pie-element/ebsr 8.12.6-next.8 → 8.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/configure/CHANGELOG.md +20 -0
- package/configure/lib/index.js +10 -7
- package/configure/lib/index.js.map +1 -1
- package/configure/package.json +2 -2
- package/configure/src/index.js +11 -5
- package/controller/CHANGELOG.md +11 -0
- package/controller/package.json +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.13.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr@8.12.5...@pie-element/ebsr@8.13.0) (2023-09-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* configuration setter fix for language props ([da6bc07](https://github.com/pie-framework/pie-elements/commit/da6bc07a067f0a4d1167ab85e07bef6c605643ad))
|
|
12
|
+
* update pie-libs PD-3167 ([1b109bb](https://github.com/pie-framework/pie-elements/commit/1b109bb3b74dcea72ee2f241996a5e6a71893b4e))
|
|
13
|
+
* update pie-libs PD-3167 ([b21d0c3](https://github.com/pie-framework/pie-elements/commit/b21d0c332623667257a5de1363b9f4fc6ee2bb51))
|
|
14
|
+
* update pie-libs PD-3167 ([1a76806](https://github.com/pie-framework/pie-elements/commit/1a7680657ebe0a73969f3100e60f0a090ffc7ada))
|
|
15
|
+
* update pie-libs PD-3167, PD-3105, PD-3162, PD-2765 ([26199b2](https://github.com/pie-framework/pie-elements/commit/26199b255ddbcb9255f2769091c7ba58f8b1dae0))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* update pie-libs PD-3011 ([0fd32b3](https://github.com/pie-framework/pie-elements/commit/0fd32b3fd1333bb25de584b98c8ef0471de2d5e8))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [8.12.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr@8.12.4...@pie-element/ebsr@8.12.5) (2023-09-18)
|
|
7
27
|
|
|
8
28
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.11.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-configure@8.10.5...@pie-element/ebsr-configure@8.11.0) (2023-09-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* configuration setter fix for language props ([da6bc07](https://github.com/pie-framework/pie-elements/commit/da6bc07a067f0a4d1167ab85e07bef6c605643ad))
|
|
12
|
+
* update pie-libs PD-3167 ([1b109bb](https://github.com/pie-framework/pie-elements/commit/1b109bb3b74dcea72ee2f241996a5e6a71893b4e))
|
|
13
|
+
* update pie-libs PD-3167 ([b21d0c3](https://github.com/pie-framework/pie-elements/commit/b21d0c332623667257a5de1363b9f4fc6ee2bb51))
|
|
14
|
+
* update pie-libs PD-3167 ([1a76806](https://github.com/pie-framework/pie-elements/commit/1a7680657ebe0a73969f3100e60f0a090ffc7ada))
|
|
15
|
+
* update pie-libs PD-3167, PD-3105, PD-3162, PD-2765 ([26199b2](https://github.com/pie-framework/pie-elements/commit/26199b255ddbcb9255f2769091c7ba58f8b1dae0))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* update pie-libs PD-3011 ([0fd32b3](https://github.com/pie-framework/pie-elements/commit/0fd32b3fd1333bb25de584b98c8ef0471de2d5e8))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [8.10.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-configure@8.10.4...@pie-element/ebsr-configure@8.10.5) (2023-09-18)
|
|
7
27
|
|
|
8
28
|
|
package/configure/lib/index.js
CHANGED
|
@@ -141,22 +141,25 @@ var EbsrConfigure = /*#__PURE__*/function (_HTMLElement) {
|
|
|
141
141
|
}, {
|
|
142
142
|
key: "configuration",
|
|
143
143
|
set: function set(c) {
|
|
144
|
-
var
|
|
144
|
+
var _newConfiguration$lan,
|
|
145
145
|
_this2 = this;
|
|
146
146
|
|
|
147
147
|
var info = prepareCustomizationObject(c, this._model);
|
|
148
|
-
|
|
148
|
+
|
|
149
|
+
var newConfiguration = _objectSpread(_objectSpread({}, _defaults2["default"].configuration), info.configuration);
|
|
150
|
+
|
|
151
|
+
this._configuration = newConfiguration; // if language:enabled is true, then the corresponding default item model should include a language value;
|
|
149
152
|
// if it is false, then the language field should be omitted from the item model.
|
|
150
153
|
// if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
|
|
151
154
|
// then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
|
|
152
155
|
|
|
153
|
-
if ((
|
|
154
|
-
var
|
|
156
|
+
if (newConfiguration !== null && newConfiguration !== void 0 && (_newConfiguration$lan = newConfiguration.language) !== null && _newConfiguration$lan !== void 0 && _newConfiguration$lan.enabled) {
|
|
157
|
+
var _newConfiguration$lan2, _newConfiguration$lan3;
|
|
155
158
|
|
|
156
|
-
if ((
|
|
157
|
-
this._model.language =
|
|
159
|
+
if (newConfiguration !== null && newConfiguration !== void 0 && (_newConfiguration$lan2 = newConfiguration.languageChoices) !== null && _newConfiguration$lan2 !== void 0 && (_newConfiguration$lan3 = _newConfiguration$lan2.options) !== null && _newConfiguration$lan3 !== void 0 && _newConfiguration$lan3.length) {
|
|
160
|
+
this._model.language = newConfiguration === null || newConfiguration === void 0 ? void 0 : newConfiguration.languageChoices.options[0].value;
|
|
158
161
|
}
|
|
159
|
-
} else if (
|
|
162
|
+
} else if (newConfiguration.language.settings && this._model.language) {
|
|
160
163
|
this._configuration.language.enabled = true;
|
|
161
164
|
|
|
162
165
|
if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["MODEL_UPDATED","ModelUpdatedEvent","TYPE","MC_TAG_NAME","EbsrMCConfigure","MultipleChoiceConfigure","defineMultipleChoice","customElements","get","define","prepareCustomizationObject","config","model","configuration","sensibleDefaults","settingsPanelDisabled","modelDefault","EbsrConfigure","m","reset","_model","createDefaultModel","dispatchModelUpdated","_render","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","update","dispatchEvent","_configuration","onConfigurationChanged","bind","resetValue","c","info","language","enabled","languageChoices","options","length","value","settings","find","option","push","label","onModelChanged","addEventListener","onModelUpdated","removeEventListener","element","React","createElement","Main","ReactDOM","render","HTMLElement","partA","partB","defaults","choicesLayout","verticalMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;AAEA,IAAMA,aAAa,GAAGC,sCAAkBC,IAAxC;AACA,IAAMC,WAAW,GAAG,gCAApB;;IAEMC,e;;;;;;;;;;;EAAwBC,e;;AAE9B,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,GAAM;AACjC,MAAI,CAACC,cAAc,CAACC,GAAf,CAAmBL,WAAnB,CAAL,EAAsC;AACpCI,IAAAA,cAAc,CAACE,MAAf,CAAsBN,WAAtB,EAAmCC,eAAnC;AACD;AACF,CAJD;;AAMAE,oBAAoB;;AAEpB,IAAMI,0BAA0B,GAAG,SAA7BA,0BAA6B,CAACC,MAAD,EAASC,KAAT,EAAmB;AACpD,MAAMC,aAAa,GAAG,0BAASF,MAAT,EAAiBG,sBAAiBD,aAAlC,CAAtB;AACAA,EAAAA,aAAa,CAACE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AA4CkD,QAA5C,uEAAuD9C,YAAvD;AAAA,uDACvB8C,QADuB,GAEvBlD,KAFuB;AAG1BgD,IAAAA,KAAK,gDACAE,QAAQ,CAACF,KADT,GAEAA,KAFA;AAGHG,MAAAA,aAAa,EACXH,KAAK,CAACG,aAAN,IAAwBH,KAAK,CAACI,YAAN,KAAuB,KAAvB,IAAgC,YAAxD,IAAyEF,QAAQ,CAACF,KAAT,CAAeG;AAJvF,MAHqB;AAS1BF,IAAAA,KAAK,gDACAC,QAAQ,CAACD,KADT,GAEAA,KAFA;AAGHE,MAAAA,aAAa,EACXF,KAAK,CAACE,aAAN,IAAwBF,KAAK,CAACG,YAAN,KAAuB,KAAvB,IAAgC,YAAxD,IAAyEF,QAAQ,CAACD,KAAT,CAAeE;AAJvF;AATqB;AAAA,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { ModelUpdatedEvent } from '@pie-framework/pie-configure-events';\nimport MultipleChoiceConfigure from '@pie-element/multiple-choice/configure/lib';\nimport defaults from 'lodash/defaults';\nimport Main from './main';\n\nimport sensibleDefaults from './defaults';\n\nconst MODEL_UPDATED = ModelUpdatedEvent.TYPE;\nconst MC_TAG_NAME = 'ebsr-multiple-choice-configure';\n\nclass EbsrMCConfigure extends MultipleChoiceConfigure {}\n\nconst defineMultipleChoice = () => {\n if (!customElements.get(MC_TAG_NAME)) {\n customElements.define(MC_TAG_NAME, EbsrMCConfigure);\n }\n};\n\ndefineMultipleChoice();\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n configuration.settingsPanelDisabled = true;\n\n return {\n configuration,\n model,\n };\n};\n\nconst { model: modelDefault } = sensibleDefaults || {};\n\nexport default class EbsrConfigure extends HTMLElement {\n static createDefaultModel = ({ partA = {}, partB = {}, ...model } = {}, defaults = modelDefault) => ({\n ...defaults,\n ...model,\n partA: {\n ...defaults.partA,\n ...partA,\n choicesLayout:\n partA.choicesLayout || (partA.verticalMode === false && 'horizontal') || defaults.partA.choicesLayout,\n },\n partB: {\n ...defaults.partB,\n ...partB,\n choicesLayout:\n partB.choicesLayout || (partB.verticalMode === false && 'horizontal') || defaults.partB.choicesLayout,\n },\n });\n\n constructor() {\n super();\n\n this._model = EbsrConfigure.createDefaultModel();\n\n this._configuration = sensibleDefaults.configuration;\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(m) {\n this._model = EbsrConfigure.createDefaultModel(m, this._model);\n\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 = EbsrConfigure.createDefaultModel(m, this._model);\n\n this.dispatchModelUpdated(reset);\n this._render();\n };\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n this._configuration = info.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 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 onModelUpdated = (e) => {\n if (e.target === this) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n const id = e.target && e.target.getAttribute('id');\n\n if (id) {\n if (e.update) {\n this._model[`part${id}`] = e.update;\n }\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model));\n }\n };\n\n connectedCallback() {\n this.addEventListener(MODEL_UPDATED, this.onModelUpdated);\n this._render();\n }\n\n disconnectedCallback() {\n this.removeEventListener(MODEL_UPDATED, this.onModelUpdated);\n }\n\n _render() {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n });\n\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["MODEL_UPDATED","ModelUpdatedEvent","TYPE","MC_TAG_NAME","EbsrMCConfigure","MultipleChoiceConfigure","defineMultipleChoice","customElements","get","define","prepareCustomizationObject","config","model","configuration","sensibleDefaults","settingsPanelDisabled","modelDefault","EbsrConfigure","m","reset","_model","createDefaultModel","dispatchModelUpdated","_render","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","update","dispatchEvent","_configuration","onConfigurationChanged","bind","resetValue","c","info","newConfiguration","language","enabled","languageChoices","options","length","value","settings","find","option","push","label","onModelChanged","addEventListener","onModelUpdated","removeEventListener","element","React","createElement","Main","ReactDOM","render","HTMLElement","partA","partB","defaults","choicesLayout","verticalMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;AAEA,IAAMA,aAAa,GAAGC,sCAAkBC,IAAxC;AACA,IAAMC,WAAW,GAAG,gCAApB;;IAEMC,e;;;;;;;;;;;EAAwBC,e;;AAE9B,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,GAAM;AACjC,MAAI,CAACC,cAAc,CAACC,GAAf,CAAmBL,WAAnB,CAAL,EAAsC;AACpCI,IAAAA,cAAc,CAACE,MAAf,CAAsBN,WAAtB,EAAmCC,eAAnC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AEtCP,QAAAA,aAAa,EAAE,KAAKmB,cAFkB;AAGtCkB,QAAAA,cAAc,EAAE,KAAKA,cAHiB;AAItCjB,QAAAA,sBAAsB,EAAE,KAAKA;AAJS,OAA1B,CAAd;;AAOAyB,2BAASC,MAAT,CAAgBL,OAAhB,EAAyB,IAAzB;AACD;;;kDArIwCM,W;;;iCAAtB3C,a,wBACS;AAAA,kFAAwC,EAAxC;AAAA,0BAAG4C,KAAH;AAAA,MAAGA,KAAH,4BAAW,EAAX;AAAA,0BAAeC,KAAf;AAAA,MAAeA,KAAf,4BAAuB,EAAvB;AAAA,MAA8BlD,KAA9B;;AAAA,MAA4CmD,QAA5C,uEAAuD/C,YAAvD;AAAA,uDACvB+C,QADuB,GAEvBnD,KAFuB;AAG1BiD,IAAAA,KAAK,gDACAE,QAAQ,CAACF,KADT,GAEAA,KAFA;AAGHG,MAAAA,aAAa,EACXH,KAAK,CAACG,aAAN,IAAwBH,KAAK,CAACI,YAAN,KAAuB,KAAvB,IAAgC,YAAxD,IAAyEF,QAAQ,CAACF,KAAT,CAAeG;AAJvF,MAHqB;AAS1BF,IAAAA,KAAK,gDACAC,QAAQ,CAACD,KADT,GAEAA,KAFA;AAGHE,MAAAA,aAAa,EACXF,KAAK,CAACE,aAAN,IAAwBF,KAAK,CAACG,YAAN,KAAuB,KAAvB,IAAgC,YAAxD,IAAyEF,QAAQ,CAACD,KAAT,CAAeE;AAJvF;AATqB;AAAA,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { ModelUpdatedEvent } from '@pie-framework/pie-configure-events';\nimport MultipleChoiceConfigure from '@pie-element/multiple-choice/configure/lib';\nimport defaults from 'lodash/defaults';\nimport Main from './main';\n\nimport sensibleDefaults from './defaults';\n\nconst MODEL_UPDATED = ModelUpdatedEvent.TYPE;\nconst MC_TAG_NAME = 'ebsr-multiple-choice-configure';\n\nclass EbsrMCConfigure extends MultipleChoiceConfigure {}\n\nconst defineMultipleChoice = () => {\n if (!customElements.get(MC_TAG_NAME)) {\n customElements.define(MC_TAG_NAME, EbsrMCConfigure);\n }\n};\n\ndefineMultipleChoice();\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n configuration.settingsPanelDisabled = true;\n\n return {\n configuration,\n model,\n };\n};\n\nconst { model: modelDefault } = sensibleDefaults || {};\n\nexport default class EbsrConfigure extends HTMLElement {\n static createDefaultModel = ({ partA = {}, partB = {}, ...model } = {}, defaults = modelDefault) => ({\n ...defaults,\n ...model,\n partA: {\n ...defaults.partA,\n ...partA,\n choicesLayout:\n partA.choicesLayout || (partA.verticalMode === false && 'horizontal') || defaults.partA.choicesLayout,\n },\n partB: {\n ...defaults.partB,\n ...partB,\n choicesLayout:\n partB.choicesLayout || (partB.verticalMode === false && 'horizontal') || defaults.partB.choicesLayout,\n },\n });\n\n constructor() {\n super();\n\n this._model = EbsrConfigure.createDefaultModel();\n\n this._configuration = sensibleDefaults.configuration;\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(m) {\n this._model = EbsrConfigure.createDefaultModel(m, this._model);\n\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 = EbsrConfigure.createDefaultModel(m, this._model);\n\n this.dispatchModelUpdated(reset);\n this._render();\n };\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n const newConfiguration = {\n ...sensibleDefaults.configuration,\n ...info.configuration,\n };\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 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 onModelUpdated = (e) => {\n if (e.target === this) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n const id = e.target && e.target.getAttribute('id');\n\n if (id) {\n if (e.update) {\n this._model[`part${id}`] = e.update;\n }\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model));\n }\n };\n\n connectedCallback() {\n this.addEventListener(MODEL_UPDATED, this.onModelUpdated);\n this._render();\n }\n\n disconnectedCallback() {\n this.removeEventListener(MODEL_UPDATED, this.onModelUpdated);\n }\n\n _render() {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n });\n\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.11.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
8
8
|
"author": "",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
|
-
"@pie-element/multiple-choice": "^7.
|
|
11
|
+
"@pie-element/multiple-choice": "^7.14.0",
|
|
12
12
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
13
13
|
"@pie-lib/config-ui": "^11.9.14",
|
|
14
14
|
"lodash": "^4.17.15",
|
package/configure/src/index.js
CHANGED
|
@@ -80,17 +80,23 @@ export default class EbsrConfigure extends HTMLElement {
|
|
|
80
80
|
|
|
81
81
|
set configuration(c) {
|
|
82
82
|
const info = prepareCustomizationObject(c, this._model);
|
|
83
|
-
|
|
83
|
+
|
|
84
|
+
const newConfiguration = {
|
|
85
|
+
...sensibleDefaults.configuration,
|
|
86
|
+
...info.configuration,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
this._configuration = newConfiguration;
|
|
84
90
|
|
|
85
91
|
// if language:enabled is true, then the corresponding default item model should include a language value;
|
|
86
92
|
// if it is false, then the language field should be omitted from the item model.
|
|
87
93
|
// if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
|
|
88
94
|
// then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
|
|
89
|
-
if (
|
|
90
|
-
if (
|
|
91
|
-
this._model.language =
|
|
95
|
+
if (newConfiguration?.language?.enabled) {
|
|
96
|
+
if (newConfiguration?.languageChoices?.options?.length) {
|
|
97
|
+
this._model.language = newConfiguration?.languageChoices.options[0].value;
|
|
92
98
|
}
|
|
93
|
-
} else if (
|
|
99
|
+
} else if (newConfiguration.language.settings && this._model.language) {
|
|
94
100
|
this._configuration.language.enabled = true;
|
|
95
101
|
|
|
96
102
|
if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.4.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-controller@6.4.0...@pie-element/ebsr-controller@6.4.1) (2023-09-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update pie-libs PD-3167, PD-3105, PD-3162, PD-2765 ([26199b2](https://github.com/pie-framework/pie-elements/commit/26199b255ddbcb9255f2769091c7ba58f8b1dae0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [6.4.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-controller@6.3.3...@pie-element/ebsr-controller@6.4.0) (2023-08-15)
|
|
7
18
|
|
|
8
19
|
|
package/controller/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.13.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@pie-element/multiple-choice": "^7.
|
|
10
|
+
"@pie-element/multiple-choice": "^7.14.0",
|
|
11
11
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"debug": "^4.1.1",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"author": "pie framework developers",
|
|
17
17
|
"license": "ISC",
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "e23c1e4531589e023b0e1f8ceda2094f392b2c1b",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"postpublish": "../../scripts/postpublish"
|
|
21
21
|
},
|