@pie-element/fraction-model 6.1.1-next.0 → 6.1.1-next.29
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.json +1 -0
- package/CHANGELOG.md +584 -0
- package/LICENSE.md +5 -0
- package/README.md +18 -0
- package/configure/CHANGELOG.json +1 -0
- package/configure/CHANGELOG.md +549 -0
- package/configure/lib/card-bar.js +57 -0
- package/configure/lib/card-bar.js.map +1 -0
- package/configure/lib/defaults.js +114 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +163 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +253 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/model-options.js +144 -0
- package/configure/lib/model-options.js.map +1 -0
- package/configure/lib/number-text-field.js +47 -0
- package/configure/lib/number-text-field.js.map +1 -0
- package/configure/package.json +24 -0
- package/controller/CHANGELOG.json +1 -0
- package/controller/CHANGELOG.md +476 -0
- package/controller/lib/defaults.js +20 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +215 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/package.json +15 -0
- package/docs/config-schema.json +1796 -0
- package/docs/config-schema.json.md +1318 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +6 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +6 -0
- package/docs/pie-schema.json +873 -0
- package/docs/pie-schema.json.md +639 -0
- package/lib/answer-fraction.js +109 -0
- package/lib/answer-fraction.js.map +1 -0
- package/lib/fraction-model-chart.js +279 -0
- package/lib/fraction-model-chart.js.map +1 -0
- package/lib/index.js +91 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +203 -0
- package/lib/main.js.map +1 -0
- package/package.json +21 -57
- package/dist/author/card-bar.d.ts +0 -20
- package/dist/author/card-bar.js +0 -40
- package/dist/author/defaults.d.ts +0 -113
- package/dist/author/defaults.js +0 -84
- package/dist/author/index.d.ts +0 -44
- package/dist/author/index.js +0 -88
- package/dist/author/main.d.ts +0 -25
- package/dist/author/main.js +0 -156
- package/dist/author/model-options.d.ts +0 -32
- package/dist/author/model-options.js +0 -85
- package/dist/author/number-text-field.d.ts +0 -15
- package/dist/author/number-text-field.js +0 -24
- package/dist/controller/defaults.d.ts +0 -21
- package/dist/controller/defaults.js +0 -13
- package/dist/controller/index.d.ts +0 -23
- package/dist/controller/index.js +0 -68
- package/dist/delivery/answer-fraction.d.ts +0 -27
- package/dist/delivery/answer-fraction.js +0 -69
- package/dist/delivery/fraction-model-chart.d.ts +0 -11
- package/dist/delivery/fraction-model-chart.js +0 -154
- package/dist/delivery/index.d.ts +0 -22
- package/dist/delivery/index.js +0 -54
- package/dist/delivery/main.d.ts +0 -38
- package/dist/delivery/main.js +0 -136
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -179
- package/dist/index.js +0 -2
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
package/dist/author/index.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import e from "./main.js";
|
|
2
|
-
import t from "./defaults.js";
|
|
3
|
-
import n from "react";
|
|
4
|
-
import { createRoot as r } from "react-dom/client";
|
|
5
|
-
import { DeleteImageEvent as i, DeleteSoundEvent as a, InsertImageEvent as o, InsertSoundEvent as s, ModelUpdatedEvent as c } from "@pie-element/shared-configure-events";
|
|
6
|
-
//#region src/author/index.ts
|
|
7
|
-
var l = class l extends HTMLElement {
|
|
8
|
-
static createDefaultModel = (e = {}) => {
|
|
9
|
-
let n = t.configuration, r = e.language || "";
|
|
10
|
-
return !r && n.language && n.language.enabled && n.languageChoices?.options?.length && (r = n.languageChoices.options[0].value), {
|
|
11
|
-
...t.model,
|
|
12
|
-
...e,
|
|
13
|
-
language: r
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
constructor() {
|
|
17
|
-
super(), this._root = null, this._model = l.createDefaultModel(), this._configuration = t.configuration;
|
|
18
|
-
}
|
|
19
|
-
set model(e) {
|
|
20
|
-
this._model = l.createDefaultModel(e), this.render();
|
|
21
|
-
}
|
|
22
|
-
set configuration(e) {
|
|
23
|
-
let n = {
|
|
24
|
-
...t.configuration,
|
|
25
|
-
...e
|
|
26
|
-
};
|
|
27
|
-
this._configuration = n, this.resetModelAfterConfigurationIsSet(), n?.language?.enabled ? n?.languageChoices?.options?.length && (this._model.language = n?.languageChoices.options[0].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({
|
|
28
|
-
value: this._model.language,
|
|
29
|
-
label: this._model.language
|
|
30
|
-
})) : delete this._model.language, this.render();
|
|
31
|
-
}
|
|
32
|
-
resetModelAfterConfigurationIsSet = () => {
|
|
33
|
-
let e = document.querySelectorAll("pie-author");
|
|
34
|
-
this.hasPlayerAsParent = Array.from(e).some((e) => e.contains(this)), this.hasPlayerAsParent && (this._modelCopy ? this._model = this._modelCopy : delete this._modelCopy);
|
|
35
|
-
};
|
|
36
|
-
connectedCallback() {
|
|
37
|
-
this.render();
|
|
38
|
-
}
|
|
39
|
-
modelChanged(e) {
|
|
40
|
-
this._model = e, this.dispatchEvent(new c(this._model), !0), this.render();
|
|
41
|
-
}
|
|
42
|
-
onChange = (e) => {
|
|
43
|
-
this._model = {
|
|
44
|
-
...this._model,
|
|
45
|
-
...e
|
|
46
|
-
}, this.dispatchEvent(new c(this._model)), this.render();
|
|
47
|
-
};
|
|
48
|
-
onConfigurationChanged(e) {
|
|
49
|
-
this._configuration = e, this.render();
|
|
50
|
-
}
|
|
51
|
-
insertImage(e) {
|
|
52
|
-
this.dispatchEvent(new o(e));
|
|
53
|
-
}
|
|
54
|
-
onDeleteImage(e, t) {
|
|
55
|
-
this.dispatchEvent(new i(e, t));
|
|
56
|
-
}
|
|
57
|
-
insertSound(e) {
|
|
58
|
-
this.dispatchEvent(new s(e));
|
|
59
|
-
}
|
|
60
|
-
onDeleteSound(e, t) {
|
|
61
|
-
this.dispatchEvent(new a(e, t));
|
|
62
|
-
}
|
|
63
|
-
render() {
|
|
64
|
-
if (this._model) {
|
|
65
|
-
let t = n.createElement(e, {
|
|
66
|
-
classes: {},
|
|
67
|
-
model: this._model,
|
|
68
|
-
configuration: this._configuration,
|
|
69
|
-
onConfigurationChanged: this.onConfigurationChanged,
|
|
70
|
-
onChange: this.onChange,
|
|
71
|
-
imageSupport: {
|
|
72
|
-
add: this.insertImage.bind(this),
|
|
73
|
-
delete: this.onDeleteImage.bind(this)
|
|
74
|
-
},
|
|
75
|
-
uploadSoundSupport: {
|
|
76
|
-
add: this.insertSound.bind(this),
|
|
77
|
-
delete: this.onDeleteSound.bind(this)
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
this._root ||= r(this), this._root.render(t);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
disconnectedCallback() {
|
|
84
|
-
this._root && this._root.unmount();
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
//#endregion
|
|
88
|
-
export { l as default };
|
package/dist/author/main.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/fraction-model/configure/src/main.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class Main extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
model: PropTypes.Validator<object>;
|
|
14
|
-
configuration: PropTypes.Validator<object>;
|
|
15
|
-
onConfigurationChanged: PropTypes.Validator<(...args: any[]) => any>;
|
|
16
|
-
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
uploadSoundSupport: PropTypes.Validator<object>;
|
|
18
|
-
};
|
|
19
|
-
constructor(props: any);
|
|
20
|
-
onCorrectAnswerChange: any;
|
|
21
|
-
onModelOptionsChange: any;
|
|
22
|
-
generateRandomKey: any;
|
|
23
|
-
render(): React.JSX.Element;
|
|
24
|
-
}
|
|
25
|
-
export default Main;
|
package/dist/author/main.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import e from "../delivery/fraction-model-chart.js";
|
|
2
|
-
import t from "./card-bar.js";
|
|
3
|
-
import n from "./model-options.js";
|
|
4
|
-
import r from "react";
|
|
5
|
-
import i from "prop-types";
|
|
6
|
-
import { styled as a } from "@mui/material/styles";
|
|
7
|
-
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
|
-
import { AlertDialog as c, FormSection as l, layout as u } from "@pie-lib/config-ui";
|
|
9
|
-
import d from "@pie-lib/editable-html-tip-tap";
|
|
10
|
-
import f from "@mui/material/Tooltip";
|
|
11
|
-
import p from "@mui/icons-material/Info";
|
|
12
|
-
//#region src/author/main.tsx
|
|
13
|
-
var m = a(l)(({ theme: e }) => ({ marginBottom: e.spacing(4) })), h = a(f)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
|
|
14
|
-
fontSize: e.typography.fontSize - 2,
|
|
15
|
-
whiteSpace: "pre",
|
|
16
|
-
maxWidth: "500px"
|
|
17
|
-
} })), g = a("div")(({ theme: e }) => ({
|
|
18
|
-
fontSize: e.typography.fontSize - 2,
|
|
19
|
-
color: e.palette.error.main,
|
|
20
|
-
marginTop: e.spacing(1)
|
|
21
|
-
})), _ = a("div")(({ theme: e, hasError: t }) => ({ ...t && { border: `2px solid ${e.palette.error.main}` } })), v = a("label")(({ theme: e }) => ({ marginBottom: e.spacing(4) })), y = class extends r.Component {
|
|
22
|
-
static propTypes = {
|
|
23
|
-
model: i.object.isRequired,
|
|
24
|
-
configuration: i.object.isRequired,
|
|
25
|
-
onConfigurationChanged: i.func.isRequired,
|
|
26
|
-
onChange: i.func.isRequired,
|
|
27
|
-
uploadSoundSupport: i.object.isRequired
|
|
28
|
-
};
|
|
29
|
-
constructor(e) {
|
|
30
|
-
super(e), this.state = { correctAnswerChangeDialog: {
|
|
31
|
-
open: !1,
|
|
32
|
-
text: ""
|
|
33
|
-
} };
|
|
34
|
-
}
|
|
35
|
-
onCorrectAnswerChange = (e) => {
|
|
36
|
-
let { model: t, onChange: n } = this.props;
|
|
37
|
-
t.correctResponse = e, n({ ...t });
|
|
38
|
-
};
|
|
39
|
-
onModelOptionsChange = (e, t, n) => {
|
|
40
|
-
let { onChange: r } = this.props;
|
|
41
|
-
n && e.correctResponse.length > 0 ? this.setState({ correctAnswerChangeDialog: {
|
|
42
|
-
open: !0,
|
|
43
|
-
oldModel: e,
|
|
44
|
-
newModel: t,
|
|
45
|
-
text: "Changing either the Number of Models or Parts per Model will remove added correct answer. Are you sure you want to continue?"
|
|
46
|
-
} }) : r({ ...t });
|
|
47
|
-
};
|
|
48
|
-
generateRandomKey = () => Math.floor(Math.random() * 1e4);
|
|
49
|
-
render() {
|
|
50
|
-
let { model: r, onChange: i, configuration: a, imageSupport: f, uploadSoundSupport: y } = this.props, { baseInputConfiguration: b = {}, contentDimensions: x = {}, title: S = {}, prompt: C = {}, modelOptions: w = {}, mathMlOptions: T = {} } = a || {}, { errors: E = {}, extraCSSRules: D, spellCheckEnabled: O, toolbarEditorPosition: k } = r || {}, { correctAnswerChangeDialog: A } = this.state, j = { position: k === "top" ? "top" : "bottom" }, M = (e = {}) => ({
|
|
51
|
-
...b,
|
|
52
|
-
...e
|
|
53
|
-
}), N = this.generateRandomKey();
|
|
54
|
-
return /* @__PURE__ */ s(u.ConfigLayout, {
|
|
55
|
-
extraCSSRules: D,
|
|
56
|
-
dimensions: x,
|
|
57
|
-
hideSettings: !0,
|
|
58
|
-
children: [
|
|
59
|
-
/* @__PURE__ */ o(t, { header: "Set Up" }),
|
|
60
|
-
/* @__PURE__ */ o(m, {
|
|
61
|
-
label: S?.label || "Title",
|
|
62
|
-
children: /* @__PURE__ */ o(d, {
|
|
63
|
-
markup: r.title || "",
|
|
64
|
-
onChange: (e) => i({ title: e }),
|
|
65
|
-
toolbarOpts: j,
|
|
66
|
-
activePlugins: [
|
|
67
|
-
"bold",
|
|
68
|
-
"html",
|
|
69
|
-
"italic",
|
|
70
|
-
"underline",
|
|
71
|
-
"strikethrough",
|
|
72
|
-
"image",
|
|
73
|
-
"math",
|
|
74
|
-
"languageCharacters",
|
|
75
|
-
"responseArea"
|
|
76
|
-
],
|
|
77
|
-
pluginProps: M(S?.inputConfiguration),
|
|
78
|
-
spellCheck: O,
|
|
79
|
-
uploadSoundSupport: y,
|
|
80
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
81
|
-
mathMlOptions: T
|
|
82
|
-
})
|
|
83
|
-
}),
|
|
84
|
-
/* @__PURE__ */ o(m, {
|
|
85
|
-
label: C?.label || "Question",
|
|
86
|
-
children: /* @__PURE__ */ o(d, {
|
|
87
|
-
markup: r.prompt || "",
|
|
88
|
-
minHeight: 60,
|
|
89
|
-
onChange: (e) => i({ prompt: e }),
|
|
90
|
-
toolbarOpts: j,
|
|
91
|
-
pluginProps: M(C?.inputConfiguration),
|
|
92
|
-
spellCheck: O,
|
|
93
|
-
uploadSoundSupport: y,
|
|
94
|
-
imageSupport: f,
|
|
95
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
96
|
-
mathMlOptions: T
|
|
97
|
-
})
|
|
98
|
-
}),
|
|
99
|
-
/* @__PURE__ */ o(l, { children: /* @__PURE__ */ o(n, {
|
|
100
|
-
model: r,
|
|
101
|
-
onChange: this.onModelOptionsChange,
|
|
102
|
-
modelOptions: w
|
|
103
|
-
}) }),
|
|
104
|
-
/* @__PURE__ */ s(l, { children: [
|
|
105
|
-
" ",
|
|
106
|
-
/* @__PURE__ */ o(t, {
|
|
107
|
-
header: "Correct Answer",
|
|
108
|
-
info: /* @__PURE__ */ o(h, {
|
|
109
|
-
disableFocusListener: !0,
|
|
110
|
-
disableTouchListener: !0,
|
|
111
|
-
placement: "right",
|
|
112
|
-
title: "The correct answer should include no more than one partially-filled model",
|
|
113
|
-
children: /* @__PURE__ */ o(p, {
|
|
114
|
-
fontSize: "small",
|
|
115
|
-
color: "primary",
|
|
116
|
-
style: { marginLeft: "8px" }
|
|
117
|
-
})
|
|
118
|
-
})
|
|
119
|
-
}),
|
|
120
|
-
/* @__PURE__ */ o("br", {}),
|
|
121
|
-
/* @__PURE__ */ o(v, { children: "Click/touch the number of parts to represent the correct fraction model" }),
|
|
122
|
-
/* @__PURE__ */ o("br", {}),
|
|
123
|
-
/* @__PURE__ */ o(_, {
|
|
124
|
-
hasError: !!E.correctResponse,
|
|
125
|
-
children: /* @__PURE__ */ o(e, {
|
|
126
|
-
value: r.correctResponse,
|
|
127
|
-
modelType: r.modelTypeSelected,
|
|
128
|
-
noOfModels: r.maxModelSelected,
|
|
129
|
-
partsPerModel: r.partsPerModel,
|
|
130
|
-
showLabel: r.showGraphLabels,
|
|
131
|
-
onChange: this.onCorrectAnswerChange
|
|
132
|
-
}, N)
|
|
133
|
-
}),
|
|
134
|
-
E.correctResponse && /* @__PURE__ */ o(g, { children: E.correctResponse })
|
|
135
|
-
] }),
|
|
136
|
-
/* @__PURE__ */ o(c, {
|
|
137
|
-
open: A.open,
|
|
138
|
-
title: "Warning",
|
|
139
|
-
text: A.text,
|
|
140
|
-
onConfirm: () => {
|
|
141
|
-
let e = this.state.correctAnswerChangeDialog.newModel;
|
|
142
|
-
e.correctResponse = [], i({ ...e }), this.setState({ correctAnswerChangeDialog: { open: !1 } });
|
|
143
|
-
},
|
|
144
|
-
onClose: () => {
|
|
145
|
-
let e = this.state.correctAnswerChangeDialog.oldModel;
|
|
146
|
-
i({ ...e }), this.setState({ correctAnswerChangeDialog: { open: !1 } });
|
|
147
|
-
},
|
|
148
|
-
onConfirmText: "OK",
|
|
149
|
-
onCloseText: "Cancel"
|
|
150
|
-
})
|
|
151
|
-
]
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
//#endregion
|
|
156
|
-
export { y as default };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/fraction-model/configure/src/model-options.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class ModelOptions extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
model: PropTypes.Validator<object>;
|
|
14
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
-
modelOptions: PropTypes.Validator<object>;
|
|
16
|
-
};
|
|
17
|
-
constructor(props: any);
|
|
18
|
-
/**
|
|
19
|
-
* Function to trigger when DOM elements value change for Number type
|
|
20
|
-
* @param {string} key contains key of element
|
|
21
|
-
* @param {object} event contains event object
|
|
22
|
-
* @param {string} value contains value of DOM element
|
|
23
|
-
*/
|
|
24
|
-
change(key: any, event: any, value: any): void;
|
|
25
|
-
/**
|
|
26
|
-
* Function to trigger on change of dropdown value model type
|
|
27
|
-
* @param {string} value contains selection value
|
|
28
|
-
*/
|
|
29
|
-
handleSelect: any;
|
|
30
|
-
render(): React.JSX.Element;
|
|
31
|
-
}
|
|
32
|
-
export default ModelOptions;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js";
|
|
2
|
-
import t from "./card-bar.js";
|
|
3
|
-
import { MiniField as n } from "./number-text-field.js";
|
|
4
|
-
import r from "react";
|
|
5
|
-
import i from "prop-types";
|
|
6
|
-
import { styled as a } from "@mui/material/styles";
|
|
7
|
-
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
|
-
import { Checkbox as c } from "@pie-lib/config-ui";
|
|
9
|
-
import l from "@mui/material/Select";
|
|
10
|
-
import u from "@mui/material/MenuItem";
|
|
11
|
-
//#region src/author/model-options.tsx
|
|
12
|
-
var d = a("div")({
|
|
13
|
-
alignItems: "center",
|
|
14
|
-
display: "flex",
|
|
15
|
-
gap: "20px"
|
|
16
|
-
}), f = a("div")({ margin: "12px 0" }), p = a("label")({
|
|
17
|
-
display: "block",
|
|
18
|
-
marginBottom: "4px"
|
|
19
|
-
}), m = a(l)({
|
|
20
|
-
width: "80px",
|
|
21
|
-
alignItems: "center",
|
|
22
|
-
height: "40px",
|
|
23
|
-
verticalAlign: "top",
|
|
24
|
-
marginBottom: "8px",
|
|
25
|
-
"& .MuiSelect-select": { paddingLeft: "10px" }
|
|
26
|
-
}), h = a("div")({ marginLeft: "-15px" }), g = a("span")({ verticalAlign: "middle" }), _ = class extends r.Component {
|
|
27
|
-
static propTypes = {
|
|
28
|
-
model: i.object.isRequired,
|
|
29
|
-
onChange: i.func,
|
|
30
|
-
modelOptions: i.object.isRequired
|
|
31
|
-
};
|
|
32
|
-
constructor(e) {
|
|
33
|
-
super(e), this.changeMaxModel = this.change.bind(this, "max"), this.changePartModel = this.change.bind(this, "part"), this.studentConfig = this.change.bind(this, "student-config");
|
|
34
|
-
}
|
|
35
|
-
change(t, n, r) {
|
|
36
|
-
let { model: i, onChange: a } = this.props, o = e(i), s = e(i), c = !1;
|
|
37
|
-
t === "max" ? (s.maxModelSelected = r, c = !0) : t === "part" ? (s.partsPerModel = r, c = !0) : t === "student-config" && (s.allowedStudentConfig = r, c = !1), a(o, s, c);
|
|
38
|
-
}
|
|
39
|
-
handleSelect = (e) => {
|
|
40
|
-
let { model: t, onChange: n } = this.props;
|
|
41
|
-
t.modelTypeSelected = e?.target.value, n(t, { ...t }, !1);
|
|
42
|
-
};
|
|
43
|
-
render() {
|
|
44
|
-
let { model: e, modelOptions: r } = this.props, { maxOfModel: i, partsPerModel: a, modelTypeChoices: l } = r;
|
|
45
|
-
return /* @__PURE__ */ s("div", { children: [
|
|
46
|
-
/* @__PURE__ */ o(t, { header: "Configure Fraction Model" }),
|
|
47
|
-
/* @__PURE__ */ o("br", {}),
|
|
48
|
-
/* @__PURE__ */ s(d, { children: [
|
|
49
|
-
/* @__PURE__ */ s(f, { children: [/* @__PURE__ */ o(p, { children: "Model Type" }), /* @__PURE__ */ o(m, {
|
|
50
|
-
onChange: this.handleSelect,
|
|
51
|
-
value: e.modelTypeSelected,
|
|
52
|
-
MenuProps: { transitionDuration: {
|
|
53
|
-
enter: 225,
|
|
54
|
-
exit: 195
|
|
55
|
-
} },
|
|
56
|
-
children: l.map((e, t) => /* @__PURE__ */ o(u, {
|
|
57
|
-
value: e.value,
|
|
58
|
-
children: e.label
|
|
59
|
-
}, "item_" + t))
|
|
60
|
-
})] }),
|
|
61
|
-
/* @__PURE__ */ s(f, { children: [/* @__PURE__ */ o(p, { children: "Max # of Models" }), /* @__PURE__ */ o(n, {
|
|
62
|
-
min: i.min,
|
|
63
|
-
max: i.max,
|
|
64
|
-
value: e.maxModelSelected,
|
|
65
|
-
name: "max-model",
|
|
66
|
-
onChange: this.changeMaxModel
|
|
67
|
-
})] }),
|
|
68
|
-
/* @__PURE__ */ s(f, { children: [/* @__PURE__ */ o(p, { children: "Parts per Model" }), /* @__PURE__ */ o(n, {
|
|
69
|
-
min: a.min,
|
|
70
|
-
max: a.max,
|
|
71
|
-
value: e.partsPerModel,
|
|
72
|
-
name: "model-parts",
|
|
73
|
-
onChange: this.changePartModel
|
|
74
|
-
})] })
|
|
75
|
-
] }),
|
|
76
|
-
/* @__PURE__ */ s(h, { children: [/* @__PURE__ */ o(c, {
|
|
77
|
-
onChange: this.studentConfig,
|
|
78
|
-
checked: e.allowedStudentConfig,
|
|
79
|
-
label: ""
|
|
80
|
-
}), /* @__PURE__ */ o(g, { children: "Allow student to configure number of models and parts per model" })] })
|
|
81
|
-
] });
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
//#endregion
|
|
85
|
-
export { _ as default };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/fraction-model/configure/src/number-text-field.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
export declare class NumberTextField extends React.Component {
|
|
11
|
-
static propTypes: {};
|
|
12
|
-
render(): React.JSX.Element;
|
|
13
|
-
}
|
|
14
|
-
export declare const MiniField: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
|
15
|
-
export default NumberTextField;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import { styled as t } from "@mui/material/styles";
|
|
3
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
-
import { NumberTextField as r } from "@pie-lib/config-ui";
|
|
5
|
-
t(r)(({ theme: e }) => ({ marginLeft: e.spacing(1) }));
|
|
6
|
-
//#region src/author/number-text-field.tsx
|
|
7
|
-
var i = t(r)({
|
|
8
|
-
maxWidth: "120px",
|
|
9
|
-
width: "120px",
|
|
10
|
-
marginTop: "0",
|
|
11
|
-
"& [class^=\"MuiInputBase-root\"]": {
|
|
12
|
-
height: 40,
|
|
13
|
-
fontSize: "14px"
|
|
14
|
-
},
|
|
15
|
-
"& [class^=\"MuiInputBase-input\"]": { padding: "18.5px 14px" }
|
|
16
|
-
});
|
|
17
|
-
e.Component;
|
|
18
|
-
var a = e.forwardRef((e, t) => /* @__PURE__ */ n(i, {
|
|
19
|
-
...e,
|
|
20
|
-
ref: t,
|
|
21
|
-
variant: "outlined"
|
|
22
|
-
}));
|
|
23
|
-
//#endregion
|
|
24
|
-
export { a as MiniField };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/fraction-model/controller/src/defaults.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: {
|
|
10
|
-
model: {
|
|
11
|
-
correctResponse: never[];
|
|
12
|
-
title: string;
|
|
13
|
-
prompt: string;
|
|
14
|
-
modelTypeSelected: string;
|
|
15
|
-
maxModelSelected: number;
|
|
16
|
-
partsPerModel: number;
|
|
17
|
-
allowedStudentConfig: boolean;
|
|
18
|
-
showGraphLabels: boolean;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export default _default;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region src/controller/defaults.ts
|
|
2
|
-
var e = { model: {
|
|
3
|
-
correctResponse: [],
|
|
4
|
-
title: "",
|
|
5
|
-
prompt: "",
|
|
6
|
-
modelTypeSelected: "bar",
|
|
7
|
-
maxModelSelected: 1,
|
|
8
|
-
partsPerModel: 5,
|
|
9
|
-
allowedStudentConfig: !1,
|
|
10
|
-
showGraphLabels: !1
|
|
11
|
-
} };
|
|
12
|
-
//#endregion
|
|
13
|
-
export { e as default };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/fraction-model/controller/src/index.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
export declare const getResponseCorrectness: (model: any, answers: any, env?: {}) => "correct" | "incorrect";
|
|
10
|
-
export declare const outcome: (model: any, session: any, env: any) => Promise<unknown>;
|
|
11
|
-
export declare const createDefaultModel: (model?: {}) => {
|
|
12
|
-
correctResponse: never[];
|
|
13
|
-
title: string;
|
|
14
|
-
prompt: string;
|
|
15
|
-
modelTypeSelected: string;
|
|
16
|
-
maxModelSelected: number;
|
|
17
|
-
partsPerModel: number;
|
|
18
|
-
allowedStudentConfig: boolean;
|
|
19
|
-
showGraphLabels: boolean;
|
|
20
|
-
};
|
|
21
|
-
export declare const model: (question: any, session: any, env: any) => Promise<unknown>;
|
|
22
|
-
export declare const createCorrectResponseSession: (model: any, env: any) => Promise<unknown>;
|
|
23
|
-
export declare const validate: (model?: {}, config?: {}) => {};
|
package/dist/controller/index.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js";
|
|
2
|
-
import t from "./defaults.js";
|
|
3
|
-
//#region src/controller/index.ts
|
|
4
|
-
var n = (e, t, n = {}) => {
|
|
5
|
-
let r;
|
|
6
|
-
return r = e.allowedStudentConfig ? !!(t.partsPerModel === e.partsPerModel && s(t.response, e.partsPerModel) && o(e.correctResponse, t.response)) : !!(s(t.response, e.partsPerModel) && o(e.correctResponse, t.response)), r ? "correct" : "incorrect";
|
|
7
|
-
}, r = (e, t, r = {}) => {
|
|
8
|
-
if (t.mode === "evaluate") return n(e, r, t);
|
|
9
|
-
}, i = (e, t, n = {}) => +(r(e, t, n) === "correct"), a = (t, n, r) => new Promise((a) => {
|
|
10
|
-
!n || e(n) ? a({
|
|
11
|
-
score: 0,
|
|
12
|
-
empty: !0
|
|
13
|
-
}) : r.mode === "evaluate" ? a({ score: i(t, r, n.answers) }) : a({
|
|
14
|
-
score: void 0,
|
|
15
|
-
completed: void 0
|
|
16
|
-
});
|
|
17
|
-
}), o = (e, t) => {
|
|
18
|
-
let n = 0, r = 0;
|
|
19
|
-
for (let t = 0; t < e.length; t++) n += e[t].value;
|
|
20
|
-
for (let e = 0; e < t.length; e++) r += t[e].value;
|
|
21
|
-
return n === r;
|
|
22
|
-
}, s = (e, t) => {
|
|
23
|
-
if (e.length > 0) {
|
|
24
|
-
let n = 0;
|
|
25
|
-
return e.forEach((e) => {
|
|
26
|
-
e.value !== t && n++;
|
|
27
|
-
}), n <= 1;
|
|
28
|
-
} else return !1;
|
|
29
|
-
}, c = (e = {}) => ({
|
|
30
|
-
...t.model,
|
|
31
|
-
...e
|
|
32
|
-
}), l = (t, n, a) => new Promise((o) => {
|
|
33
|
-
n ||= {};
|
|
34
|
-
let s = c(t), l, u;
|
|
35
|
-
(!n || e(n)) && a.mode === "evaluate" ? (l = "unanswered", u = "0%") : (l = r(s, a, n && n.answers), u = `${i(s, a, n && n.answers) * 100}%`);
|
|
36
|
-
let d = {
|
|
37
|
-
score: u,
|
|
38
|
-
correctness: l
|
|
39
|
-
}, f = {
|
|
40
|
-
env: a,
|
|
41
|
-
...s,
|
|
42
|
-
view: a.mode === "view" || a.mode === "evaluate"
|
|
43
|
-
};
|
|
44
|
-
a.mode === "evaluate" && Object.assign(f, { correctness: d }), o(f);
|
|
45
|
-
}), u = (e, t) => new Promise((n) => {
|
|
46
|
-
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
47
|
-
let { correctResponse: t, maxModelSelected: r, partsPerModel: i } = e;
|
|
48
|
-
n({
|
|
49
|
-
answers: {
|
|
50
|
-
response: t,
|
|
51
|
-
noOfModel: r,
|
|
52
|
-
partsPerModel: i
|
|
53
|
-
},
|
|
54
|
-
id: "1"
|
|
55
|
-
});
|
|
56
|
-
} else n(null);
|
|
57
|
-
}), d = (e = {}, t = {}) => {
|
|
58
|
-
let n = {};
|
|
59
|
-
if (e.correctResponse.length === 0 && (n.correctResponse = "To save the item, at least one section must be marked as correct."), e.correctResponse.length > 0) {
|
|
60
|
-
let t = 0;
|
|
61
|
-
e.correctResponse.forEach((n) => {
|
|
62
|
-
n.value !== e.partsPerModel && t++;
|
|
63
|
-
}), t > 1 && (n.correctResponse = "The correct answer should include no more than one partially-filled model");
|
|
64
|
-
}
|
|
65
|
-
return n;
|
|
66
|
-
};
|
|
67
|
-
//#endregion
|
|
68
|
-
export { u as createCorrectResponseSession, c as createDefaultModel, n as getResponseCorrectness, l as model, a as outcome, d as validate };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/fraction-model/src/answer-fraction.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class AnswerFraction extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
model: PropTypes.Validator<object>;
|
|
14
|
-
disabled: PropTypes.Validator<boolean>;
|
|
15
|
-
showCorrect: PropTypes.Validator<boolean>;
|
|
16
|
-
onAnswerChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
answers: PropTypes.Validator<object>;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Function to trigger when value change from number selection
|
|
21
|
-
* @param {string} key contains event change object
|
|
22
|
-
* @returns updated answer change object
|
|
23
|
-
*/
|
|
24
|
-
onValueChange: (key: any) => (event: any) => void;
|
|
25
|
-
render(): React.JSX.Element;
|
|
26
|
-
}
|
|
27
|
-
export default AnswerFraction;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "prop-types";
|
|
3
|
-
import { styled as n } from "@mui/material/styles";
|
|
4
|
-
import { TextField as r } from "@mui/material";
|
|
5
|
-
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
-
//#region src/delivery/answer-fraction.tsx
|
|
7
|
-
var o = n("div")({
|
|
8
|
-
alignItems: "center",
|
|
9
|
-
display: "flex",
|
|
10
|
-
gap: "20px"
|
|
11
|
-
}), s = n("div")({ margin: "12px 0" }), c = n("label")({
|
|
12
|
-
display: "block",
|
|
13
|
-
marginBottom: "4px"
|
|
14
|
-
}), l = n(r)({
|
|
15
|
-
width: "120px",
|
|
16
|
-
maxHeight: "40px",
|
|
17
|
-
"& [class^=\"MuiInputBase-root\"]": {
|
|
18
|
-
height: 40,
|
|
19
|
-
fontSize: "14px"
|
|
20
|
-
}
|
|
21
|
-
}), u = class extends e.Component {
|
|
22
|
-
static propTypes = {
|
|
23
|
-
model: t.object.isRequired,
|
|
24
|
-
disabled: t.bool.isRequired,
|
|
25
|
-
showCorrect: t.bool.isRequired,
|
|
26
|
-
onAnswerChange: t.func.isRequired,
|
|
27
|
-
answers: t.object.isRequired
|
|
28
|
-
};
|
|
29
|
-
onValueChange = (e) => (t) => {
|
|
30
|
-
let n = parseInt(t?.target?.value), { model: r, onAnswerChange: i, answers: a } = this.props, o = { ...a }, s = e === "noOfModel" ? r.maxModelSelected : 9;
|
|
31
|
-
n > s ? n = s : n < 1 && (n = 1), o[e] = n, i(o);
|
|
32
|
-
};
|
|
33
|
-
render() {
|
|
34
|
-
let { model: e, showCorrect: t, answers: n, disabled: r } = this.props;
|
|
35
|
-
return /* @__PURE__ */ i("div", { children: e.allowedStudentConfig && /* @__PURE__ */ a(o, { children: [/* @__PURE__ */ a(s, { children: [/* @__PURE__ */ i(c, {
|
|
36
|
-
htmlFor: "preview_number-of-models",
|
|
37
|
-
children: "Number of Models"
|
|
38
|
-
}), /* @__PURE__ */ i(l, {
|
|
39
|
-
id: "preview_number-of-models",
|
|
40
|
-
inputProps: {
|
|
41
|
-
min: 1,
|
|
42
|
-
max: e.maxModelSelected
|
|
43
|
-
},
|
|
44
|
-
name: "preview_number-of-models",
|
|
45
|
-
onChange: this.onValueChange("noOfModel"),
|
|
46
|
-
type: "number",
|
|
47
|
-
variant: "outlined",
|
|
48
|
-
disabled: r,
|
|
49
|
-
value: t ? e.maxModelSelected : n.noOfModel
|
|
50
|
-
})] }), /* @__PURE__ */ a(s, { children: [/* @__PURE__ */ i(c, {
|
|
51
|
-
htmlFor: "preview_parts-per-model",
|
|
52
|
-
children: "Parts per Model"
|
|
53
|
-
}), /* @__PURE__ */ i(l, {
|
|
54
|
-
id: "preview_parts-per-model",
|
|
55
|
-
inputProps: {
|
|
56
|
-
min: 1,
|
|
57
|
-
max: 9
|
|
58
|
-
},
|
|
59
|
-
name: "preview_parts-per-model",
|
|
60
|
-
onChange: this.onValueChange("partsPerModel"),
|
|
61
|
-
type: "number",
|
|
62
|
-
variant: "outlined",
|
|
63
|
-
disabled: r,
|
|
64
|
-
value: t ? e.partsPerModel : n.partsPerModel
|
|
65
|
-
})] })] }) });
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
//#endregion
|
|
69
|
-
export { u as default };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/fraction-model/src/fraction-model-chart.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
declare const FractionModelChart: (props: any) => React.JSX.Element | undefined;
|
|
11
|
-
export default FractionModelChart;
|