@pie-element/fraction-model 0.1.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/dist/author/card-bar.d.ts +21 -0
- package/dist/author/card-bar.d.ts.map +1 -0
- package/dist/author/card-bar.js +40 -0
- package/dist/author/defaults.d.ts +114 -0
- package/dist/author/defaults.d.ts.map +1 -0
- package/dist/author/defaults.js +84 -0
- package/dist/author/index.d.ts +45 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +88 -0
- package/dist/author/main.d.ts +26 -0
- package/dist/author/main.d.ts.map +1 -0
- package/dist/author/main.js +156 -0
- package/dist/author/model-options.d.ts +33 -0
- package/dist/author/model-options.d.ts.map +1 -0
- package/dist/author/model-options.js +85 -0
- package/dist/author/number-text-field.d.ts +16 -0
- package/dist/author/number-text-field.d.ts.map +1 -0
- package/dist/author/number-text-field.js +20 -0
- package/dist/controller/defaults.d.ts +22 -0
- package/dist/controller/defaults.d.ts.map +1 -0
- package/dist/controller/defaults.js +13 -0
- package/dist/controller/index.d.ts +24 -0
- package/dist/controller/index.d.ts.map +1 -0
- package/dist/controller/index.js +68 -0
- package/dist/delivery/answer-fraction.d.ts +28 -0
- package/dist/delivery/answer-fraction.d.ts.map +1 -0
- package/dist/delivery/answer-fraction.js +69 -0
- package/dist/delivery/fraction-model-chart.d.ts +12 -0
- package/dist/delivery/fraction-model-chart.d.ts.map +1 -0
- package/dist/delivery/fraction-model-chart.js +154 -0
- package/dist/delivery/index.d.ts +23 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +54 -0
- package/dist/delivery/main.d.ts +39 -0
- package/dist/delivery/main.d.ts.map +1 -0
- package/dist/delivery/main.js +136 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.iife.d.ts +9 -0
- package/dist/index.iife.d.ts.map +1 -0
- package/dist/index.iife.js +179 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
- package/package.json +70 -0
- package/src/author/card-bar.tsx +67 -0
- package/src/author/defaults.ts +88 -0
- package/src/author/index.ts +187 -0
- package/src/author/main.tsx +243 -0
- package/src/author/model-options.tsx +158 -0
- package/src/author/number-text-field.tsx +42 -0
- package/src/controller/defaults.ts +23 -0
- package/src/controller/index.ts +207 -0
- package/src/delivery/answer-fraction.tsx +113 -0
- package/src/delivery/fraction-model-chart.tsx +261 -0
- package/src/delivery/index.ts +96 -0
- package/src/delivery/main.tsx +256 -0
- package/src/index.iife.ts +16 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import e from "../node_modules/.bun/lodash-es@4.17.23/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 };
|
|
@@ -0,0 +1,16 @@
|
|
|
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;
|
|
16
|
+
//# sourceMappingURL=number-text-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-text-field.d.ts","sourceRoot":"","sources":["../../src/author/number-text-field.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAiB1B,qBAAa,eAAgB,SAAQ,KAAK,CAAC,SAAS;IAClD,MAAM,CAAC,SAAS,KAAM;IAEtB,MAAM;CAIP;AAED,eAAO,MAAM,SAAS,+DAEpB,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
var i = t(r)({
|
|
7
|
+
maxWidth: "120px",
|
|
8
|
+
width: "120px",
|
|
9
|
+
marginTop: "0",
|
|
10
|
+
"& [class^=\"MuiInputBase-root\"]": {
|
|
11
|
+
height: 40,
|
|
12
|
+
fontSize: "14px"
|
|
13
|
+
}
|
|
14
|
+
}), a = e.forwardRef((e, t) => /* @__PURE__ */ n(i, {
|
|
15
|
+
...e,
|
|
16
|
+
ref: t,
|
|
17
|
+
variant: "outlined"
|
|
18
|
+
}));
|
|
19
|
+
//#endregion
|
|
20
|
+
export { a as MiniField };
|
|
@@ -0,0 +1,22 @@
|
|
|
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;
|
|
22
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/controller/defaults.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;;;;;;;;;;;;;AAGH,wBAWE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|
|
@@ -0,0 +1,24 @@
|
|
|
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?: {}) => {};
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/controller/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAYH,eAAO,MAAM,sBAAsB,GAAI,UAAK,EAAE,YAAO,EAAE,QAAQ,4BAc9D,CAAC;AAkCF,eAAO,MAAM,OAAO,GAAI,UAAK,EAAE,YAAO,EAAE,QAAG,qBAWvC,CAAC;AA2CL,eAAO,MAAM,kBAAkB,GAAI,UAAU;;;;;;;;;CAG3C,CAAC;AAKH,eAAO,MAAM,KAAK,GAAI,aAAQ,EAAE,YAAO,EAAE,QAAG,qBA4B3C,CAAC;AAQF,eAAO,MAAM,4BAA4B,GAAI,UAAK,EAAE,QAAG,qBAgBtD,CAAC;AAOF,eAAO,MAAM,QAAQ,GAAI,UAAU,EAAE,WAAW,OAiB/C,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import e from "../node_modules/.bun/lodash-es@4.17.23/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" ? 1 : 0, 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 };
|
|
@@ -0,0 +1,28 @@
|
|
|
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;
|
|
28
|
+
//# sourceMappingURL=answer-fraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answer-fraction.d.ts","sourceRoot":"","sources":["../../src/delivery/answer-fraction.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AA4BnC,qBAAa,cAAe,SAAQ,KAAK,CAAC,SAAS;IACjD,MAAM,CAAC,SAAS;;;;;;MAMd;IAEF;;;;OAIG;IACH,aAAa,GAAI,QAAG,MAAM,UAAK,UAa7B;IAEF,MAAM;CA0CP;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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 };
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
12
|
+
//# sourceMappingURL=fraction-model-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fraction-model-chart.d.ts","sourceRoot":"","sources":["../../src/delivery/fraction-model-chart.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAsC,MAAM,OAAO,CAAC;AA2B3D,QAAA,MAAM,kBAAkB,GAAI,UAAK,kCA6NhC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { useEffect as e, useRef as t, useState as n } from "react";
|
|
2
|
+
import { styled as r } from "@mui/material/styles";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
import { Bar as o, BarChart as s, Cell as c, LabelList as l, Pie as u, PieChart as d, YAxis as f } from "recharts";
|
|
5
|
+
//#region src/delivery/fraction-model-chart.tsx
|
|
6
|
+
var p = r("div")({
|
|
7
|
+
display: "grid",
|
|
8
|
+
gridTemplateColumns: "200px 200px 200px",
|
|
9
|
+
gap: "10px",
|
|
10
|
+
padding: "5px 0"
|
|
11
|
+
}), m = r("div")({
|
|
12
|
+
display: "grid",
|
|
13
|
+
gridTemplateColumns: "200px 200px 200px",
|
|
14
|
+
gap: "20px",
|
|
15
|
+
padding: "10px 0"
|
|
16
|
+
}), h = r(d)({ "& .recharts-pie-sector": {
|
|
17
|
+
outline: "none !important",
|
|
18
|
+
"&:focus": { outline: "none !important" }
|
|
19
|
+
} }), g = (r) => {
|
|
20
|
+
let d = (e, t) => {
|
|
21
|
+
typeof t == "string" && (t = parseInt(t));
|
|
22
|
+
let n = A.findIndex((t) => t.id === e), r;
|
|
23
|
+
r = n >= 0 ? A[n].value === t ? A.filter((e, t) => t !== n) : [
|
|
24
|
+
...A.slice(0, n),
|
|
25
|
+
{
|
|
26
|
+
id: e,
|
|
27
|
+
value: t
|
|
28
|
+
},
|
|
29
|
+
...A.slice(n + 1)
|
|
30
|
+
] : [...A, {
|
|
31
|
+
id: e,
|
|
32
|
+
value: t
|
|
33
|
+
}], D(r), j(r);
|
|
34
|
+
}, g = (e, t) => {
|
|
35
|
+
k(e + "-" + t);
|
|
36
|
+
}, _ = () => {
|
|
37
|
+
k(null);
|
|
38
|
+
}, v = (e, t) => {
|
|
39
|
+
let [n, r] = t.split("-").map(Number), i = A.find((e) => e.id === n);
|
|
40
|
+
if (i && r <= i.value) return "rgb(60, 73, 150, 0.6)";
|
|
41
|
+
if (e) {
|
|
42
|
+
let [t, i] = e.split("-").map(Number);
|
|
43
|
+
if (t === n && i >= r) return "rgb(0, 0, 0, 0.25)";
|
|
44
|
+
}
|
|
45
|
+
return "#FFFFFF";
|
|
46
|
+
}, y = (e) => {
|
|
47
|
+
let { cx: t, cy: n, midAngle: r, outerRadius: a, index: o } = e, s = Math.PI / 180, c = a * 1.13, l = t + c * Math.cos(-r * s);
|
|
48
|
+
return /* @__PURE__ */ i("text", {
|
|
49
|
+
x: l,
|
|
50
|
+
y: n + c * Math.sin(-r * s),
|
|
51
|
+
fill: "#000000",
|
|
52
|
+
textAnchor: l > t ? "start" : "end",
|
|
53
|
+
dominantBaseline: "central",
|
|
54
|
+
children: `${(o + 1).toFixed(0)}`
|
|
55
|
+
});
|
|
56
|
+
}, b = () => (e) => {
|
|
57
|
+
let { fill: t, x: n, y: r, width: a, height: o } = e;
|
|
58
|
+
return /* @__PURE__ */ i("g", { children: /* @__PURE__ */ i("rect", {
|
|
59
|
+
x: n,
|
|
60
|
+
y: r,
|
|
61
|
+
width: a,
|
|
62
|
+
height: o,
|
|
63
|
+
stroke: "#000000",
|
|
64
|
+
fill: t
|
|
65
|
+
}) });
|
|
66
|
+
}, { value: x = [], modelType: S = "bar", noOfModels: C = 0, partsPerModel: w = 0, showLabel: T = !1, disabled: E = !1, onChange: D } = r, [O, k] = n(null), [A, j] = n(x), M = () => {
|
|
67
|
+
let e = [];
|
|
68
|
+
for (let t = 1; t < C + 1; t++) {
|
|
69
|
+
let n = [{ name: t }];
|
|
70
|
+
for (let e = 1; e < w + 1; e++) n[0][`${e}`] = 1;
|
|
71
|
+
e.push(n);
|
|
72
|
+
}
|
|
73
|
+
let t = [];
|
|
74
|
+
return e.forEach((e, n) => {
|
|
75
|
+
t.push(/* @__PURE__ */ a(s, {
|
|
76
|
+
width: 200,
|
|
77
|
+
height: 30 * w,
|
|
78
|
+
data: e,
|
|
79
|
+
children: [/* @__PURE__ */ i(f, {
|
|
80
|
+
hide: !0,
|
|
81
|
+
type: "number",
|
|
82
|
+
domain: [0, w]
|
|
83
|
+
}), Object.keys(e[0]).map((e, t) => {
|
|
84
|
+
if (e !== "name") return /* @__PURE__ */ i(o, {
|
|
85
|
+
dataKey: e,
|
|
86
|
+
stackId: "a",
|
|
87
|
+
onClick: E ? null : () => d(n + 1, e),
|
|
88
|
+
onMouseEnter: E ? null : () => g(n + 1, e),
|
|
89
|
+
onMouseLeave: E ? null : () => _(n + 1, e),
|
|
90
|
+
shape: b(),
|
|
91
|
+
isAnimationActive: !1,
|
|
92
|
+
fill: v(O, `${n + 1}-${e}`),
|
|
93
|
+
children: T && /* @__PURE__ */ i(l, {
|
|
94
|
+
position: "left",
|
|
95
|
+
fill: "#000000"
|
|
96
|
+
})
|
|
97
|
+
}, `bar-${n + 1}-${t + 1}`);
|
|
98
|
+
})]
|
|
99
|
+
}, `bar-chart-${n + 1}`));
|
|
100
|
+
}), /* @__PURE__ */ i(m, { children: t });
|
|
101
|
+
}, N = t(null), P = () => {
|
|
102
|
+
let e = [];
|
|
103
|
+
for (let t = 1; t < C + 1; t++) {
|
|
104
|
+
let t = Array.from({ length: w }, (e, t) => ({
|
|
105
|
+
name: `${t + 1}`,
|
|
106
|
+
value: 1
|
|
107
|
+
}));
|
|
108
|
+
e.push(t);
|
|
109
|
+
}
|
|
110
|
+
let t = [];
|
|
111
|
+
return e.forEach((e, n) => {
|
|
112
|
+
t.push(/* @__PURE__ */ i(h, {
|
|
113
|
+
width: 200,
|
|
114
|
+
height: 200,
|
|
115
|
+
children: /* @__PURE__ */ i(u, {
|
|
116
|
+
data: e,
|
|
117
|
+
fill: "#FFFFFF",
|
|
118
|
+
stroke: "#000000",
|
|
119
|
+
dataKey: "value",
|
|
120
|
+
startAngle: 90,
|
|
121
|
+
endAngle: -270,
|
|
122
|
+
isAnimationActive: !1,
|
|
123
|
+
labelLine: !1,
|
|
124
|
+
label: T && y,
|
|
125
|
+
children: e.map((e, t) => /* @__PURE__ */ i(c, {
|
|
126
|
+
onClick: E ? null : () => d(n + 1, t + 1),
|
|
127
|
+
onMouseEnter: E ? null : () => g(n + 1, t + 1),
|
|
128
|
+
onMouseLeave: E ? null : () => _(n + 1, t + 1),
|
|
129
|
+
fill: v(O, `${n + 1}-${t + 1}`),
|
|
130
|
+
style: {
|
|
131
|
+
outline: "none",
|
|
132
|
+
cursor: E ? "default" : "pointer"
|
|
133
|
+
}
|
|
134
|
+
}, `${n + 1}-${t + 1}`))
|
|
135
|
+
}, `pie-${n + 1}`)
|
|
136
|
+
}, `pie-chart-${n}`));
|
|
137
|
+
}), /* @__PURE__ */ i(p, {
|
|
138
|
+
ref: N,
|
|
139
|
+
children: t
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
if (S === "bar") return M();
|
|
143
|
+
if (S === "pie") return e(() => {
|
|
144
|
+
if (N?.current && w === 1) {
|
|
145
|
+
let e = N.current.querySelectorAll("path");
|
|
146
|
+
e.length > 0 && e.forEach((e) => {
|
|
147
|
+
let t = e.getAttribute("d");
|
|
148
|
+
e.setAttribute("d", t.replaceAll("L 100,100", ""));
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}, []), P();
|
|
152
|
+
};
|
|
153
|
+
//#endregion
|
|
154
|
+
export { g as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/fraction-model/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
|
+
import FractionModelChart from './fraction-model-chart.js';
|
|
10
|
+
export { FractionModelChart };
|
|
11
|
+
export default class FractionModel extends HTMLElement {
|
|
12
|
+
constructor();
|
|
13
|
+
set model(m: any);
|
|
14
|
+
get model(): any;
|
|
15
|
+
set session(s: any);
|
|
16
|
+
get session(): any;
|
|
17
|
+
isSessionComplete(session: any, model: any): boolean;
|
|
18
|
+
onSessionChange(session: any): void;
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
_render(): void;
|
|
21
|
+
disconnectedCallback(): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delivery/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAQH,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;;IAMpD,IAAI,KAAK,CAAC,CAAC,KAAA,EAGV;IAED,IAAI,KAAK,QAER;IAED,IAAI,OAAO,CAAC,CAAC,KAAA,EAGZ;IAED,IAAI,OAAO,QAEV;IAOD,iBAAiB,CAAC,OAAO,KAAA,EAAE,KAAK,KAAA;IAWhC,eAAe,CAAC,OAAO,KAAA;IAMvB,iBAAiB;IAIjB,OAAO;IAmBP,oBAAoB;CAKrB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import e from "./fraction-model-chart.js";
|
|
2
|
+
import t from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js";
|
|
3
|
+
import n from "./main.js";
|
|
4
|
+
import r from "react";
|
|
5
|
+
import { createRoot as i } from "react-dom/client";
|
|
6
|
+
import { SessionChangedEvent as a } from "@pie-element/shared-player-events";
|
|
7
|
+
import { renderMath as o } from "@pie-element/shared-math-rendering-mathjax";
|
|
8
|
+
//#region src/delivery/index.ts
|
|
9
|
+
var s = class extends HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), this._root = null;
|
|
12
|
+
}
|
|
13
|
+
set model(e) {
|
|
14
|
+
this._model = e, this._render();
|
|
15
|
+
}
|
|
16
|
+
get model() {
|
|
17
|
+
return this._model;
|
|
18
|
+
}
|
|
19
|
+
set session(e) {
|
|
20
|
+
this._session = e, this._render();
|
|
21
|
+
}
|
|
22
|
+
get session() {
|
|
23
|
+
return this._session;
|
|
24
|
+
}
|
|
25
|
+
isSessionComplete(e, t) {
|
|
26
|
+
let n = e && e.answers, r = t.allowedStudentConfig ? n.noOfModel > 0 && n.partsPerModel > 0 : !0, i = Array.isArray(n.response) && n.response.length > 0;
|
|
27
|
+
return r && i;
|
|
28
|
+
}
|
|
29
|
+
onSessionChange(e) {
|
|
30
|
+
this._session.answers = e && e.answers;
|
|
31
|
+
let t = this.isSessionComplete(this._session, this._model);
|
|
32
|
+
this.dispatchEvent(new a(this.tagName.toLowerCase(), t));
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
this._render();
|
|
36
|
+
}
|
|
37
|
+
_render() {
|
|
38
|
+
if (this._model && this._session) {
|
|
39
|
+
let e = t(this._model), a = r.createElement(n, {
|
|
40
|
+
model: e,
|
|
41
|
+
session: this._session,
|
|
42
|
+
onSessionChange: this.onSessionChange.bind(this)
|
|
43
|
+
});
|
|
44
|
+
this._root ||= i(this), this._root.render(a), queueMicrotask(() => {
|
|
45
|
+
o(this);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
disconnectedCallback() {
|
|
50
|
+
this._root && this._root.unmount();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { e as FractionModelChart, s as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/fraction-model/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.Requireable<object>;
|
|
14
|
+
session: PropTypes.Requireable<object>;
|
|
15
|
+
onSessionChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
constructor(props: any);
|
|
18
|
+
/**
|
|
19
|
+
* Function to trigger when session value change for fraction model
|
|
20
|
+
*/
|
|
21
|
+
callOnSessionChange: any;
|
|
22
|
+
/**
|
|
23
|
+
* Function to generate answers for preview selection
|
|
24
|
+
* @param {object} model contains model object for fraction model
|
|
25
|
+
* @returns answer model
|
|
26
|
+
*/
|
|
27
|
+
generateAnswers: any;
|
|
28
|
+
/**
|
|
29
|
+
* Function to trigger when answer change from preview
|
|
30
|
+
* @param {object} newAnswers contains updated answer model
|
|
31
|
+
*/
|
|
32
|
+
onAnswerChange: any;
|
|
33
|
+
toggleShowCorrect: any;
|
|
34
|
+
onResponseChange: any;
|
|
35
|
+
generateRandomKey: any;
|
|
36
|
+
render(): React.JSX.Element;
|
|
37
|
+
}
|
|
38
|
+
export default Main;
|
|
39
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/delivery/main.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AA+CnC,qBAAa,IAAK,SAAQ,KAAK,CAAC,SAAS;IACvC,MAAM,CAAC,SAAS;;;;MAId;gBAEU,KAAK,KAAA;IAgBjB;;OAEG;IACH,mBAAmB,EAAE,GAAG,CAKtB;IAEF;;;;OAIG;IACH,eAAe,EAAE,GAAG,CAQlB;IAEF;;;OAGG;IACH,cAAc,EAAE,GAAG,CAuBjB;IAMF,iBAAiB,EAAE,GAAG,CAEpB;IAMF,gBAAgB,EAAE,GAAG,CAanB;IAKF,iBAAiB,EAAE,GAAG,CAEpB;IAEF,MAAM;CAoFP;AAED,eAAe,IAAI,CAAC"}
|