@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
|
@@ -1,154 +0,0 @@
|
|
|
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 };
|
package/dist/delivery/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/delivery/index.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import e from "./fraction-model-chart.js";
|
|
2
|
-
import t from "../node_modules/.bun/lodash-es@4.18.1/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 };
|
package/dist/delivery/main.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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;
|
package/dist/delivery/main.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import e from "./answer-fraction.js";
|
|
2
|
-
import t from "./fraction-model-chart.js";
|
|
3
|
-
import n from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.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 c from "@pie-lib/correct-answer-toggle";
|
|
9
|
-
import { AlertDialog as l } from "@pie-lib/config-ui";
|
|
10
|
-
import * as u from "@pie-lib/render-ui";
|
|
11
|
-
import { PreviewPrompt as d, UiLayout as f } from "@pie-lib/render-ui";
|
|
12
|
-
//#region src/delivery/main.tsx
|
|
13
|
-
function p(e) {
|
|
14
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
15
|
-
}
|
|
16
|
-
function m(e, t) {
|
|
17
|
-
return !e || p(e) ? e : p(e.default) ? e.default : t && p(e[t]) ? e[t] : t && p(e[t]?.default) ? e[t].default : e;
|
|
18
|
-
}
|
|
19
|
-
var h = m(f, "UiLayout") || m(y.UiLayout, "UiLayout"), g = m(d, "PreviewPrompt") || m(y.PreviewPrompt, "PreviewPrompt"), _ = u, v = _.default, y = v && typeof v == "object" ? v : _, b = a("div")({ padding: "16px" }), x = a("div")({
|
|
20
|
-
textAlign: "center",
|
|
21
|
-
fontSize: "20px"
|
|
22
|
-
}), S = class extends r.Component {
|
|
23
|
-
static propTypes = {
|
|
24
|
-
model: i.object,
|
|
25
|
-
session: i.object,
|
|
26
|
-
onSessionChange: i.func.isRequired
|
|
27
|
-
};
|
|
28
|
-
constructor(e) {
|
|
29
|
-
super(e), this.state = {
|
|
30
|
-
session: {
|
|
31
|
-
...e.session,
|
|
32
|
-
answers: e.session && e.session.answers || this.generateAnswers(e.model)
|
|
33
|
-
},
|
|
34
|
-
showCorrect: !1,
|
|
35
|
-
answerChangeDialog: {
|
|
36
|
-
open: !1,
|
|
37
|
-
text: ""
|
|
38
|
-
}
|
|
39
|
-
}, this.callOnSessionChange();
|
|
40
|
-
}
|
|
41
|
-
callOnSessionChange = () => {
|
|
42
|
-
let { onSessionChange: e } = this.props;
|
|
43
|
-
e && e(this.state.session);
|
|
44
|
-
};
|
|
45
|
-
generateAnswers = (e) => {
|
|
46
|
-
let t = { response: [] };
|
|
47
|
-
return e.allowedStudentConfig && (t.noOfModel = "", t.partsPerModel = ""), t;
|
|
48
|
-
};
|
|
49
|
-
onAnswerChange = (e) => {
|
|
50
|
-
let t = n(this.state.session), r = {
|
|
51
|
-
...this.state.session,
|
|
52
|
-
answers: e
|
|
53
|
-
};
|
|
54
|
-
e.response.length > 0 ? this.setState({ answerChangeDialog: {
|
|
55
|
-
open: !0,
|
|
56
|
-
oldSession: t,
|
|
57
|
-
newSession: r,
|
|
58
|
-
text: "Changing either the Number of Models or Parts per Model will remove added answer. Are you sure you want to continue?"
|
|
59
|
-
} }) : this.setState((e) => ({ session: r }), this.callOnSessionChange);
|
|
60
|
-
};
|
|
61
|
-
toggleShowCorrect = (e) => {
|
|
62
|
-
this.setState({ showCorrect: e });
|
|
63
|
-
};
|
|
64
|
-
onResponseChange = (e) => {
|
|
65
|
-
this.setState((t) => ({ session: {
|
|
66
|
-
...t.session,
|
|
67
|
-
answers: {
|
|
68
|
-
...t.session.answers,
|
|
69
|
-
response: e
|
|
70
|
-
}
|
|
71
|
-
} }), this.callOnSessionChange);
|
|
72
|
-
};
|
|
73
|
-
generateRandomKey = () => Math.floor(Math.random() * 1e4);
|
|
74
|
-
render() {
|
|
75
|
-
let { model: n } = this.props, { showCorrect: r, session: i, answerChangeDialog: a } = this.state, { prompt: u, title: d, correctness: f = {}, extraCSSRules: p, language: m } = n, _ = f.correctness && f.correctness !== "correct", v = this.generateRandomKey();
|
|
76
|
-
return /* @__PURE__ */ o(h, {
|
|
77
|
-
extraCSSRules: p,
|
|
78
|
-
children: /* @__PURE__ */ s(b, { children: [
|
|
79
|
-
/* @__PURE__ */ o(x, { children: /* @__PURE__ */ o(g, {
|
|
80
|
-
className: "prompt",
|
|
81
|
-
prompt: d,
|
|
82
|
-
tagName: "h3"
|
|
83
|
-
}) }),
|
|
84
|
-
/* @__PURE__ */ o(g, {
|
|
85
|
-
className: "prompt",
|
|
86
|
-
prompt: u,
|
|
87
|
-
tagName: "p"
|
|
88
|
-
}),
|
|
89
|
-
/* @__PURE__ */ o(c, {
|
|
90
|
-
language: m,
|
|
91
|
-
show: _,
|
|
92
|
-
toggled: r,
|
|
93
|
-
onToggle: this.toggleShowCorrect
|
|
94
|
-
}),
|
|
95
|
-
/* @__PURE__ */ o(e, {
|
|
96
|
-
model: n,
|
|
97
|
-
showCorrect: r,
|
|
98
|
-
disabled: n.view,
|
|
99
|
-
onAnswerChange: this.onAnswerChange,
|
|
100
|
-
answers: i.answers
|
|
101
|
-
}),
|
|
102
|
-
/* @__PURE__ */ o(t, {
|
|
103
|
-
disabled: n.view,
|
|
104
|
-
value: r ? n.correctResponse : i.answers.response,
|
|
105
|
-
modelType: n.modelTypeSelected,
|
|
106
|
-
noOfModels: r ? n.maxModelSelected : n.allowedStudentConfig ? i.answers.noOfModel : n.maxModelSelected,
|
|
107
|
-
partsPerModel: r ? n.partsPerModel : n.allowedStudentConfig ? i.answers.partsPerModel : n.partsPerModel,
|
|
108
|
-
showLabel: n.showGraphLabels,
|
|
109
|
-
onChange: this.onResponseChange
|
|
110
|
-
}, v),
|
|
111
|
-
/* @__PURE__ */ o(l, {
|
|
112
|
-
open: a.open,
|
|
113
|
-
title: "Warning",
|
|
114
|
-
text: a.text,
|
|
115
|
-
onConfirm: () => {
|
|
116
|
-
let e = this.state.answerChangeDialog.newSession;
|
|
117
|
-
e.answers.response = [], this.setState(() => ({
|
|
118
|
-
session: e,
|
|
119
|
-
answerChangeDialog: { open: !1 }
|
|
120
|
-
}), this.callOnSessionChange);
|
|
121
|
-
},
|
|
122
|
-
onClose: () => {
|
|
123
|
-
this.setState((e) => ({
|
|
124
|
-
session: e.answerChangeDialog.oldSession,
|
|
125
|
-
answerChangeDialog: { open: !1 }
|
|
126
|
-
}), this.callOnSessionChange);
|
|
127
|
-
},
|
|
128
|
-
onConfirmText: "OK",
|
|
129
|
-
onCloseText: "Cancel"
|
|
130
|
-
})
|
|
131
|
-
] })
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
//#endregion
|
|
136
|
-
export { S as default };
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './delivery/index.js';
|
package/dist/index.iife.d.ts
DELETED