@pie-element/fraction-model 7.0.4-next.20261011174919 → 7.0.4
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/dist/author/defaults.d.ts +37 -32
- package/dist/author/index.d.ts +19 -21
- package/dist/author/index.js +13 -6
- package/dist/author/main.d.ts +34 -12
- package/dist/author/main.js +30 -38
- package/dist/browser/author/index.js +13 -13
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +1 -1
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/author/index.js +13 -13
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/controller/index.js +1 -1
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/controller/defaults.d.ts +5 -4
- package/dist/controller/index.d.ts +47 -8
- package/dist/controller/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/schemas/configuration.schema.json +389 -0
- package/dist/schemas/model.schema.json +372 -0
- package/dist/schemas/session.schema.json +79 -0
- package/dist/types.d.ts +169 -0
- package/package.json +17 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["// @ts-nocheck\n\n// Should be exactly the same as configure/defaults.js\nexport default {\n model: {\n correctResponse: [],\n title: '',\n prompt: '',\n modelTypeSelected: 'bar',\n maxModelSelected: 1,\n partsPerModel: 5,\n allowedStudentConfig: false,\n showGraphLabels: false,\n },\n};\n","// @ts-nocheck\n\nimport { isEmpty } from '@pie-element/shared-lodash';\nimport defaults from './defaults.js';\n\n/*\n * Function to check the correctness of the response\n * @param {model} model contains the model object\n * @param {answers} answers contains the answers object\n * @param {env} env contains the environment object\n * @returns {string} returns the correctness of the response\n * */\nexport const getResponseCorrectness = (model, answers, env = {}) => {\n let correct;\n if (model.allowedStudentConfig) {\n correct = !!(\n answers.partsPerModel === model.partsPerModel &&\n partialFillCheck(answers.response, model.partsPerModel) &&\n numeratorCheck(model.correctResponse, answers.response)\n );\n } else {\n correct = !!(\n partialFillCheck(answers.response, model.partsPerModel) && numeratorCheck(model.correctResponse, answers.response)\n );\n }\n return correct ? 'correct' : 'incorrect';\n};\n\n/*\n * Function to get the correctness of the response\n * @param {question} question contains the question object\n * @param {env} env contains the environment object\n * @param {answers} answers contains the answers object\n * @returns {string} returns the correctness\n * */\nconst getCorrectness = (question, env, answers = {}) => {\n if (env.mode === 'evaluate') {\n return getResponseCorrectness(question, answers, env);\n }\n};\n\n/*\n * Function to get the outcome score\n * @param {question} question contains the question object\n * @param {env} env contains the environment object\n * @param {answers} answers contains the answers object\n * @returns {number} returns the score\n * */\nconst getOutComeScore = (question, env, answers = {}) => {\n const correctness = getCorrectness(question, env, answers);\n return correctness === 'correct' ? 1 : 0;\n};\n\n// A player sends an untouched item's session as `{ id, element }`, without `answers`.\nconst isUnanswered = (session) => !session || isEmpty(session) || !session.answers;\n\n/*\n * Function to check outcome of the session\n * @param {model} model contains the model object\n * @param {session} session contains the session object\n * @param {env} env contains the environment object\n * @returns {Promise} returns the score\n */\nexport const outcome = (model, session, env) =>\n new Promise((resolve) => {\n if (isUnanswered(session)) {\n resolve({ score: 0, empty: true });\n } else {\n if (env.mode !== 'evaluate') {\n resolve({ score: undefined, completed: undefined });\n } else {\n resolve({ score: getOutComeScore(model, env, session.answers) });\n }\n }\n });\n\n/*\n * Function to check if the numerator of the response matches the numerator of the correct response\n * @param {correctResponse} correctResponse contains the correct response object\n * @param {response} response contains the response object\n * @returns {boolean} returns true if the numerators match\n * */\nconst numeratorCheck = (correctResponse, response) => {\n let correctNumerator = 0;\n let responseNumerator = 0;\n for (let i = 0; i < correctResponse.length; i++) {\n correctNumerator += correctResponse[i].value;\n }\n for (let i = 0; i < response.length; i++) {\n responseNumerator += response[i].value;\n }\n return correctNumerator === responseNumerator;\n};\n\n/*\n * Function to check if the response contains more than one partially-filled model\n * @param {response} response contains the response object\n * @param {partsPerModel} partsPerModel contains the number of parts per model\n * */\nconst partialFillCheck = (response, partsPerModel) => {\n if (response.length > 0) {\n let partialModelCount = 0;\n response.forEach((selection) => {\n if (selection.value !== partsPerModel) {\n partialModelCount++;\n }\n });\n return partialModelCount <= 1;\n } else {\n return false;\n }\n};\n\n/*\n * Function to create a default model\n * @param {model} model contains the model object\n * */\nexport const createDefaultModel = (model = {}) => ({\n ...defaults.model,\n ...model,\n});\n\n/*\n * Return the model object\n * */\nexport const model = (question, session, env) => {\n return new Promise((resolve) => {\n session = session || {};\n const model = createDefaultModel(question);\n let correctness, score;\n if (isUnanswered(session) && env.mode === 'evaluate') {\n correctness = 'unanswered';\n score = '0%';\n } else {\n correctness = getCorrectness(model, env, session && session.answers);\n score = `${getOutComeScore(model, env, session && session.answers) * 100}%`;\n }\n const correctInfo = {\n score,\n correctness,\n };\n const out = {\n env,\n ...model,\n view: env.mode === 'view' || env.mode === 'evaluate',\n };\n if (env.mode === 'evaluate') {\n Object.assign(out, {\n correctness: correctInfo,\n });\n }\n resolve(out);\n });\n};\n\n/*\n * Function to create a correct response session\n * @param {model} model contains the model object\n * @param {env} env contains the environment object\n * @returns {Promise} returns the correct response session\n * */\nexport const createCorrectResponseSession = (model, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctResponse, maxModelSelected, partsPerModel } = model;\n resolve({\n answers: {\n response: correctResponse,\n noOfModel: maxModelSelected,\n partsPerModel,\n },\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\n/*\n * Function to validate the model\n * @param {model} model contains the model object\n * @param {config} config contains the config object\n * */\nexport const validate = (model = {}, config = {}) => {\n const errors = {};\n if (model.correctResponse.length === 0) {\n errors.correctResponse = 'To save the item, at least one section must be marked as correct.';\n }\n if (model.correctResponse.length > 0) {\n let partialModelCount = 0;\n model.correctResponse.forEach((selection) => {\n if (selection.value !== model.partsPerModel) {\n partialModelCount++;\n }\n });\n if (partialModelCount > 1) {\n errors.correctResponse = 'The correct answer should include no more than one partially-filled model';\n }\n }\n return errors;\n};\n"],"mappings":";;AAGA,IAAA,IAAe,EACb,OAAO;CACL,iBAAiB,CAAC;CAClB,OAAO;CACP,QAAQ;CACR,mBAAmB;CACnB,kBAAkB;CAClB,eAAe;CACf,sBAAsB;CACtB,iBAAiB;AACnB,EACF,GCFa,KAA0B,GAAO,GAAS,IAAM,CAAC,MAAM;CAClE,IAAI;CAYJ,OAXA,AAOE,IAPE,EAAM,uBACE,CAAC,EACT,EAAQ,kBAAkB,EAAM,iBAChC,EAAiB,EAAQ,UAAU,EAAM,aAAa,KACtD,EAAe,EAAM,iBAAiB,EAAQ,QAAQ,KAG9C,CAAC,EACT,EAAiB,EAAQ,UAAU,EAAM,aAAa,KAAK,EAAe,EAAM,iBAAiB,EAAQ,QAAQ,IAG9G,IAAU,YAAY;AAC/B,GASM,KAAkB,GAAU,GAAK,IAAU,CAAC,MAAM;CACtD,IAAI,EAAI,SAAS,YACf,OAAO,EAAuB,GAAU,GAAS,CAAG;AAExD,GASM,KAAmB,GAAU,GAAK,IAAU,CAAC,MAC7B,IAAe,GAAU,GAAK,CAC3C,MAAgB,YAInB,KAAgB,MAAY,CAAC,KAAW,EAAQ,CAAO,KAAK,CAAC,EAAQ,SAS9D,KAAW,GAAO,GAAS,MACtC,IAAI,SAAS,MAAY;CACvB,AAAI,EAAa,CAAO,IACtB,EAAQ;EAAE,OAAO;EAAG,OAAO;CAAK,CAAC,IAE7B,EAAI,SAAS,aAGf,EAAQ,EAAE,OAAO,EAAgB,GAAO,GAAK,EAAQ,OAAO,EAAE,CAAC,IAF/D,EAAQ;EAAE,OAAO,KAAA;EAAW,WAAW,KAAA;CAAU,CAAC;AAKxD,CAAC,GAQG,KAAkB,GAAiB,MAAa;CACpD,IAAI,IAAmB,GACnB,IAAoB;CACxB,KAAK,IAAI,IAAI,GAAG,IAAI,EAAgB,QAAQ,KAC1C,KAAoB,EAAgB,EAAE,CAAC;CAE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AO,kBAAkB,sEAEvB,EAAM,gBAAgB,SAAS,GAAG;EACpC,IAAI,IAAoB;EAMxB,AALA,EAAM,gBAAgB,SAAS,MAAc;GAC3C,AAAI,EAAU,UAAU,EAAM,iBAC5B;EAEJ,CAAC,GACG,IAAoB,MACtB,EAAO,kBAAkB;CAE7B;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["import type { FractionModelModel, FractionModelResponse } from '../types.js';\n\n// Should be exactly the same as configure/defaults.js\nexport default {\n model: {\n correctResponse: [] as FractionModelResponse[],\n title: '',\n prompt: '',\n modelTypeSelected: 'bar',\n maxModelSelected: 1,\n partsPerModel: 5,\n allowedStudentConfig: false,\n showGraphLabels: false,\n },\n} satisfies { model: Omit<FractionModelModel, 'id' | 'element'> };\n","import { isEmpty } from '@pie-element/shared-lodash';\nimport type { PieEnvironment } from '@pie-element/shared-types';\nimport defaults from './defaults.js';\nimport type {\n FractionModelAnswers,\n FractionModelConfiguration,\n FractionModelModel,\n FractionModelResponse,\n FractionModelSession,\n} from '../types.js';\n\n/** Whether a response matches the correct response */\nexport type FractionModelCorrectness = 'correct' | 'incorrect';\n\n/** What `outcome()` resolves: empty for an unanswered session, no score outside evaluate mode */\nexport type FractionModelOutcome =\n | { score: number; empty: true }\n | { score: undefined; completed: undefined }\n | { score: number };\n\n/** Messages `validate()` returns, keyed by the model property they concern */\nexport type FractionModelValidationErrors = {\n correctResponse?: string;\n};\n\n/*\n * Function to check the correctness of the response\n * @param {model} model contains the model object\n * @param {answers} answers contains the answers object\n * @param {env} env contains the environment object\n * @returns {string} returns the correctness of the response\n * */\nexport const getResponseCorrectness = (\n model: Partial<FractionModelModel>,\n answers: Partial<FractionModelAnswers>,\n _env: Partial<PieEnvironment> = {}\n): FractionModelCorrectness => {\n let correct;\n // An absent `correctResponse` or `response` throws below, as it did untyped.\n if (model.allowedStudentConfig) {\n correct = !!(\n answers.partsPerModel === model.partsPerModel &&\n partialFillCheck(answers.response!, model.partsPerModel) &&\n numeratorCheck(model.correctResponse!, answers.response!)\n );\n } else {\n correct = !!(\n partialFillCheck(answers.response!, model.partsPerModel) && numeratorCheck(model.correctResponse!, answers.response!)\n );\n }\n return correct ? 'correct' : 'incorrect';\n};\n\n/*\n * Function to get the correctness of the response\n * @param {question} question contains the question object\n * @param {env} env contains the environment object\n * @param {answers} answers contains the answers object\n * @returns {string} returns the correctness\n * */\nconst getCorrectness = (\n question: Partial<FractionModelModel>,\n env: PieEnvironment,\n answers: Partial<FractionModelAnswers> = {}\n): FractionModelCorrectness | undefined => {\n if (env.mode === 'evaluate') {\n return getResponseCorrectness(question, answers, env);\n }\n};\n\n/*\n * Function to get the outcome score\n * @param {question} question contains the question object\n * @param {env} env contains the environment object\n * @param {answers} answers contains the answers object\n * @returns {number} returns the score\n * */\nconst getOutComeScore = (\n question: Partial<FractionModelModel>,\n env: PieEnvironment,\n answers: Partial<FractionModelAnswers> = {}\n): number => {\n const correctness = getCorrectness(question, env, answers);\n return correctness === 'correct' ? 1 : 0;\n};\n\n// A player sends an untouched item's session as `{ id, element }`, without `answers`.\nconst isUnanswered = (session: FractionModelSession | null | undefined) =>\n !session || isEmpty(session) || !session.answers;\n\n/*\n * Function to check outcome of the session\n * @param {model} model contains the model object\n * @param {session} session contains the session object\n * @param {env} env contains the environment object\n * @returns {Promise} returns the score\n */\nexport const outcome = (\n model: FractionModelModel,\n session: FractionModelSession | null | undefined,\n env: PieEnvironment\n): Promise<FractionModelOutcome> =>\n new Promise((resolve) => {\n if (isUnanswered(session)) {\n resolve({ score: 0, empty: true });\n } else {\n if (env.mode !== 'evaluate') {\n resolve({ score: undefined, completed: undefined });\n } else {\n // isUnanswered() ruled out a missing session.\n resolve({ score: getOutComeScore(model, env, session?.answers) });\n }\n }\n });\n\n/*\n * Function to check if the numerator of the response matches the numerator of the correct response\n * @param {correctResponse} correctResponse contains the correct response object\n * @param {response} response contains the response object\n * @returns {boolean} returns true if the numerators match\n * */\nconst numeratorCheck = (correctResponse: FractionModelResponse[], response: FractionModelResponse[]) => {\n let correctNumerator = 0;\n let responseNumerator = 0;\n for (let i = 0; i < correctResponse.length; i++) {\n correctNumerator += correctResponse[i].value;\n }\n for (let i = 0; i < response.length; i++) {\n responseNumerator += response[i].value;\n }\n return correctNumerator === responseNumerator;\n};\n\n/*\n * Function to check if the response contains more than one partially-filled model\n * @param {response} response contains the response object\n * @param {partsPerModel} partsPerModel contains the number of parts per model\n * */\nconst partialFillCheck = (response: FractionModelResponse[], partsPerModel: number | undefined) => {\n if (response.length > 0) {\n let partialModelCount = 0;\n response.forEach((selection) => {\n if (selection.value !== partsPerModel) {\n partialModelCount++;\n }\n });\n return partialModelCount <= 1;\n } else {\n return false;\n }\n};\n\n/*\n * Function to create a default model\n * @param {model} model contains the model object\n * */\nexport const createDefaultModel = (model: Partial<FractionModelModel> = {}) => ({\n ...defaults.model,\n ...model,\n});\n\n/** A model with the controller defaults applied */\nexport type FractionModelNormalizedModel = ReturnType<typeof createDefaultModel>;\n\n/** What `model()` resolves */\nexport type FractionModelViewModel = FractionModelNormalizedModel & {\n env: PieEnvironment;\n /** Whether the student can no longer change the response */\n view: boolean;\n /** Set in evaluate mode */\n correctness?: {\n /** The score as a percentage, e.g. `100%` */\n score: string;\n correctness: FractionModelCorrectness | 'unanswered' | undefined;\n };\n};\n\n/*\n * Return the model object\n * */\nexport const model = (\n question: FractionModelModel,\n session: FractionModelSession | null | undefined,\n env: PieEnvironment\n): Promise<FractionModelViewModel> => {\n return new Promise((resolve) => {\n session = session || {};\n const model = createDefaultModel(question);\n let correctness: FractionModelCorrectness | 'unanswered' | undefined, score: string;\n if (isUnanswered(session) && env.mode === 'evaluate') {\n correctness = 'unanswered';\n score = '0%';\n } else {\n correctness = getCorrectness(model, env, session && session.answers);\n score = `${getOutComeScore(model, env, session && session.answers) * 100}%`;\n }\n const correctInfo = {\n score,\n correctness,\n };\n const out: FractionModelViewModel = {\n env,\n ...model,\n view: env.mode === 'view' || env.mode === 'evaluate',\n };\n if (env.mode === 'evaluate') {\n Object.assign(out, {\n correctness: correctInfo,\n });\n }\n resolve(out);\n });\n};\n\n/*\n * Function to create a correct response session\n * @param {model} model contains the model object\n * @param {env} env contains the environment object\n * @returns {Promise} returns the correct response session\n * */\nexport const createCorrectResponseSession = (\n model: FractionModelModel,\n env: PieEnvironment\n): Promise<FractionModelSession | null> => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctResponse, maxModelSelected, partsPerModel } = model;\n resolve({\n answers: {\n // A model without `correctResponse` yields a session without `response`.\n response: correctResponse as FractionModelResponse[],\n noOfModel: maxModelSelected,\n partsPerModel,\n },\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\n/*\n * Function to validate the model\n * @param {model} model contains the model object\n * @param {config} config contains the config object\n * */\nexport const validate = (\n model: Partial<FractionModelModel> = {},\n _config: FractionModelConfiguration = {}\n): FractionModelValidationErrors => {\n const errors: FractionModelValidationErrors = {};\n // An absent `correctResponse` throws here, as it did untyped.\n if (model.correctResponse!.length === 0) {\n errors.correctResponse = 'To save the item, at least one section must be marked as correct.';\n }\n if (model.correctResponse!.length > 0) {\n let partialModelCount = 0;\n model.correctResponse!.forEach((selection) => {\n if (selection.value !== model.partsPerModel) {\n partialModelCount++;\n }\n });\n if (partialModelCount > 1) {\n errors.correctResponse = 'The correct answer should include no more than one partially-filled model';\n }\n }\n return errors;\n};\n"],"mappings":";;AAGA,IAAA,IAAe,EACb,OAAO;CACL,iBAAiB,CAAC;CAClB,OAAO;CACP,QAAQ;CACR,mBAAmB;CACnB,kBAAkB;CAClB,eAAe;CACf,sBAAsB;CACtB,iBAAiB;AACnB,EACF,GCkBa,KACX,GACA,GACA,IAAgC,CAAC,MACJ;CAC7B,IAAI;CAaJ,OAXA,AAOE,IAPE,EAAM,uBACE,CAAC,EACT,EAAQ,kBAAkB,EAAM,iBAChC,EAAiB,EAA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A,MAEO,IAAI,SAAS,MAAY;CAC9B,MAAqB,CAAC;CACtB,IAAM,IAAQ,EAAmB,CAAQ,GACrC,GAAkE;CACtE,AAAI,EAAa,CAAO,KAAK,EAAI,SAAS,cACxC,IAAc,cACd,IAAQ,SAER,IAAc,EAAe,GAAO,GAAK,KAAW,EAAQ,OAAO,GACnE,IAAQ,GAAG,EAAgB,GAAO,GAAK,KAAW,EAAQ,OAAO,IAAI,IAAI;CAE3E,IAAM,IAAc;EAClB;EACA;CACF,GACM,IAA8B;EAClC;EACA,GAAG;EACH,MAAM,EAAI,SAAS,UAAU,EAAI,SAAS;CAC5C;CAMA,AALI,EAAI,SAAS,cACf,OAAO,OAAO,GAAK,EACjB,aAAa,EACf,CAAC,GAEH,EAAQ,CAAG;AACb,CAAC,GASU,KACX,GACA,MAEO,IAAI,SAAS,MAAY;CAC9B,IAAI,EAAI,SAAS,cAAc,EAAI,SAAS,cAAc;EACxD,IAAM,EAAE,oBAAiB,qBAAkB,qBAAkB;EAC7D,EAAQ;GACN,SAAS;IAEP,UAAU;IACV,WAAW;IACX;GACF;GACA,IAAI;EACN,CAAC;CACH,OACE,EAAQ,IAAI;AAEhB,CAAC,GAQU,KACX,IAAqC,CAAC,GACtC,IAAsC,CAAC,MACL;CAClC,IAAM,IAAwC,CAAC;CAK/C,IAHI,EAAM,gBAAiB,WAAW,MACpC,EAAO,kBAAkB,sEAEvB,EAAM,gBAAiB,SAAS,GAAG;EACrC,IAAI,IAAoB;EAMxB,AALA,EAAM,gBAAiB,SAAS,MAAc;GAC5C,AAAI,EAAU,UAAU,EAAM,iBAC5B;EAEJ,CAAC,GACG,IAAoB,MACtB,EAAO,kBAAkB;CAE7B;CACA,OAAO;AACT"}
|
|
@@ -15780,13 +15780,6 @@ var Db = F.forwardRef((e, t) => /* @__PURE__ */ R(Eb, {
|
|
|
15780
15780
|
color: e.palette.error.main,
|
|
15781
15781
|
marginTop: e.spacing(1)
|
|
15782
15782
|
})), Rb = M("div")(({ theme: e, hasError: t }) => ({ ...t && { border: `2px solid ${e.palette.error.main}` } })), zb = M("label")(({ theme: e }) => ({ marginBottom: e.spacing(4) })), Bb = class extends F.Component {
|
|
15783
|
-
static propTypes = {
|
|
15784
|
-
model: B.default.object.isRequired,
|
|
15785
|
-
configuration: B.default.object.isRequired,
|
|
15786
|
-
onConfigurationChanged: B.default.func.isRequired,
|
|
15787
|
-
onChange: B.default.func.isRequired,
|
|
15788
|
-
uploadSoundSupport: B.default.object.isRequired
|
|
15789
|
-
};
|
|
15790
15783
|
constructor(e) {
|
|
15791
15784
|
super(e), this.state = { correctAnswerChangeDialog: {
|
|
15792
15785
|
open: !1,
|
|
@@ -16052,6 +16045,9 @@ var Db = F.forwardRef((e, t) => /* @__PURE__ */ R(Eb, {
|
|
|
16052
16045
|
settingsPanelDisabled: !0
|
|
16053
16046
|
}
|
|
16054
16047
|
}, qb = class e extends HTMLElement {
|
|
16048
|
+
_root;
|
|
16049
|
+
_model;
|
|
16050
|
+
_configuration;
|
|
16055
16051
|
static createDefaultModel = (e = {}) => {
|
|
16056
16052
|
let t = Kb.configuration, n = e.language || "";
|
|
16057
16053
|
return !n && t.language && t.language.enabled && t.languageChoices?.options?.length && (n = t.languageChoices.options[0].value), {
|
|
@@ -16071,10 +16067,15 @@ var Db = F.forwardRef((e, t) => /* @__PURE__ */ R(Eb, {
|
|
|
16071
16067
|
...Kb.configuration,
|
|
16072
16068
|
...e
|
|
16073
16069
|
};
|
|
16074
|
-
this._configuration = t, this.resetModelAfterConfigurationIsSet(), t?.language?.enabled
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
|
|
16070
|
+
if (this._configuration = t, this.resetModelAfterConfigurationIsSet(), t?.language?.enabled) t?.languageChoices?.options?.length && (this._model.language = t?.languageChoices.options[0].value);
|
|
16071
|
+
else if (t.language.settings && this._model.language) {
|
|
16072
|
+
let e = this._model.language, t = this._configuration.languageChoices;
|
|
16073
|
+
this._configuration.language.enabled = !0, (!t.options || !t.options.length) && (t.options = []), t.options.find((t) => t.value === e) || t.options.push({
|
|
16074
|
+
value: e,
|
|
16075
|
+
label: e
|
|
16076
|
+
});
|
|
16077
|
+
} else delete this._model.language;
|
|
16078
|
+
this.render();
|
|
16078
16079
|
}
|
|
16079
16080
|
resetModelAfterConfigurationIsSet = () => {
|
|
16080
16081
|
let e = document.querySelectorAll("pie-author");
|
|
@@ -16084,7 +16085,7 @@ var Db = F.forwardRef((e, t) => /* @__PURE__ */ R(Eb, {
|
|
|
16084
16085
|
this.render();
|
|
16085
16086
|
}
|
|
16086
16087
|
modelChanged(e) {
|
|
16087
|
-
this._model = e, this.dispatchEvent(new Vb(this._model)
|
|
16088
|
+
this._model = e, this.dispatchEvent(new Vb(this._model)), this.render();
|
|
16088
16089
|
}
|
|
16089
16090
|
onChange = (e) => {
|
|
16090
16091
|
this._model = {
|
|
@@ -16110,7 +16111,6 @@ var Db = F.forwardRef((e, t) => /* @__PURE__ */ R(Eb, {
|
|
|
16110
16111
|
render() {
|
|
16111
16112
|
if (this._model) {
|
|
16112
16113
|
let e = F.createElement(Bb, {
|
|
16113
|
-
classes: {},
|
|
16114
16114
|
model: this._model,
|
|
16115
16115
|
configuration: this._configuration,
|
|
16116
16116
|
onConfigurationChanged: this.onConfigurationChanged,
|