@pie-lib/rubric 2.1.0-beta.9 → 3.0.0-next.36
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/authoring.d.ts +62 -0
- package/dist/authoring.js +298 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +9 -0
- package/dist/point-menu.d.ts +27 -0
- package/dist/point-menu.js +73 -0
- package/package.json +32 -11
- package/CHANGELOG.json +0 -1
- package/CHANGELOG.md +0 -1448
- package/lib/authoring.js +0 -496
- package/lib/authoring.js.map +0 -1
- package/lib/index.js +0 -20
- package/lib/index.js.map +0 -1
- package/lib/point-menu.js +0 -125
- package/lib/point-menu.js.map +0 -1
- package/src/authoring.jsx +0 -413
- package/src/index.js +0 -9
- package/src/point-menu.jsx +0 -87
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/rubric/src/authoring.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 const RubricType: PropTypes.Requireable<PropTypes.InferProps<{
|
|
12
|
+
excludeZero: PropTypes.Requireable<boolean>;
|
|
13
|
+
points: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
14
|
+
sampleAnswers: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
15
|
+
maxPoints: PropTypes.Requireable<number>;
|
|
16
|
+
rubriclessInstruction: PropTypes.Requireable<string>;
|
|
17
|
+
}>>;
|
|
18
|
+
export declare const PointConfig: (props: any) => React.JSX.Element;
|
|
19
|
+
export declare class RawAuthoring extends React.Component {
|
|
20
|
+
static propTypes: {
|
|
21
|
+
value: PropTypes.Requireable<PropTypes.InferProps<{
|
|
22
|
+
excludeZero: PropTypes.Requireable<boolean>;
|
|
23
|
+
points: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
24
|
+
sampleAnswers: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
25
|
+
maxPoints: PropTypes.Requireable<number>;
|
|
26
|
+
rubriclessInstruction: PropTypes.Requireable<string>;
|
|
27
|
+
}>>;
|
|
28
|
+
config: PropTypes.Requireable<object>;
|
|
29
|
+
pluginOpts: PropTypes.Requireable<object>;
|
|
30
|
+
rubricless: PropTypes.Requireable<boolean>;
|
|
31
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
32
|
+
};
|
|
33
|
+
static defaultProps: {};
|
|
34
|
+
dragEnd: any;
|
|
35
|
+
changeRubriclessInstruction: any;
|
|
36
|
+
changeMaxPoints: any;
|
|
37
|
+
changeContent: any;
|
|
38
|
+
excludeZeros: any;
|
|
39
|
+
getPointForIndex: any;
|
|
40
|
+
getMaxPoint: (value: any) => any;
|
|
41
|
+
shouldRenderPoint: any;
|
|
42
|
+
onPointMenuChange: any;
|
|
43
|
+
render(): React.JSX.Element;
|
|
44
|
+
}
|
|
45
|
+
declare const Reverse: {
|
|
46
|
+
(props: any): React.JSX.Element;
|
|
47
|
+
propTypes: {
|
|
48
|
+
value: PropTypes.Requireable<PropTypes.InferProps<{
|
|
49
|
+
excludeZero: PropTypes.Requireable<boolean>;
|
|
50
|
+
points: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
51
|
+
sampleAnswers: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
52
|
+
maxPoints: PropTypes.Requireable<number>;
|
|
53
|
+
rubriclessInstruction: PropTypes.Requireable<string>;
|
|
54
|
+
}>>;
|
|
55
|
+
config: PropTypes.Requireable<object>;
|
|
56
|
+
pluginOpts: PropTypes.Requireable<object>;
|
|
57
|
+
rubricless: PropTypes.Requireable<boolean>;
|
|
58
|
+
getIndex: PropTypes.Requireable<(...args: any[]) => any>;
|
|
59
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export default Reverse;
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import e from "./point-menu.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { styled as r } from "@mui/material/styles";
|
|
5
|
+
import i from "@mui/material/InputLabel";
|
|
6
|
+
import a from "@mui/material/OutlinedInput";
|
|
7
|
+
import o from "@mui/material/Select";
|
|
8
|
+
import s from "@mui/material/FormControl";
|
|
9
|
+
import c from "@mui/material/MenuItem";
|
|
10
|
+
import { range as l, takeRight as u, times as d } from "@pie-element/shared-lodash";
|
|
11
|
+
import f from "@mui/material/Checkbox";
|
|
12
|
+
import p from "@mui/material/FormGroup";
|
|
13
|
+
import m from "@mui/material/FormControlLabel";
|
|
14
|
+
import h from "@mui/material/Typography";
|
|
15
|
+
import g from "@mui/icons-material/DragIndicator";
|
|
16
|
+
import { DragDropContext as _, Draggable as v, Droppable as y } from "@hello-pangea/dnd";
|
|
17
|
+
import b from "debug";
|
|
18
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
19
|
+
import C from "@pie-lib/editable-html-tip-tap";
|
|
20
|
+
import { InputContainer as w } from "@pie-lib/config-ui";
|
|
21
|
+
import { grey as T } from "@mui/material/colors";
|
|
22
|
+
//#region src/authoring.tsx
|
|
23
|
+
var E = b("pie-lib:rubric:authoring"), D = (e, t, n) => {
|
|
24
|
+
let r = Array.from(e), [i] = r.splice(t, 1);
|
|
25
|
+
return r.splice(n, 0, i), r;
|
|
26
|
+
}, O = n.shape({
|
|
27
|
+
excludeZero: n.bool,
|
|
28
|
+
points: n.arrayOf(n.string),
|
|
29
|
+
sampleAnswers: n.arrayOf(n.string),
|
|
30
|
+
maxPoints: n.number,
|
|
31
|
+
rubriclessInstruction: n.string
|
|
32
|
+
}), k = (e) => {
|
|
33
|
+
let { value: t, onChange: n, max: r } = e, u = "max-points-label";
|
|
34
|
+
return /* @__PURE__ */ S(s, {
|
|
35
|
+
sx: {
|
|
36
|
+
minWidth: 120,
|
|
37
|
+
m: 1
|
|
38
|
+
},
|
|
39
|
+
variant: "outlined",
|
|
40
|
+
children: [/* @__PURE__ */ x(i, {
|
|
41
|
+
id: u,
|
|
42
|
+
children: "Max Points"
|
|
43
|
+
}), /* @__PURE__ */ x(o, {
|
|
44
|
+
labelId: u,
|
|
45
|
+
label: "Max Points",
|
|
46
|
+
value: t,
|
|
47
|
+
onChange: (e) => n(e.target.value),
|
|
48
|
+
input: /* @__PURE__ */ x(a, { label: "Max Points" }),
|
|
49
|
+
MenuProps: { transitionDuration: {
|
|
50
|
+
enter: 225,
|
|
51
|
+
exit: 195
|
|
52
|
+
} },
|
|
53
|
+
children: l(1, r + 1).map((e) => /* @__PURE__ */ x(c, {
|
|
54
|
+
value: e,
|
|
55
|
+
children: e
|
|
56
|
+
}, `${e}`))
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
}, A = (e) => e === null || e === "null", j = r("div")(() => ({
|
|
60
|
+
display: "flex",
|
|
61
|
+
width: "100%",
|
|
62
|
+
position: "relative"
|
|
63
|
+
})), M = r("div")(({ theme: e }) => ({
|
|
64
|
+
width: "100%",
|
|
65
|
+
backgroundColor: `${e.palette.common.white}`
|
|
66
|
+
})), N = r(g)(({ theme: e }) => ({
|
|
67
|
+
paddingTop: e.spacing(1),
|
|
68
|
+
color: T[500]
|
|
69
|
+
})), P = r(h)(({ theme: e }) => ({
|
|
70
|
+
color: T[500],
|
|
71
|
+
paddingBottom: e.spacing(1),
|
|
72
|
+
textTransform: "uppercase"
|
|
73
|
+
})), F = r("div")(({ theme: e }) => ({ paddingLeft: e.spacing(3) })), I = r("div")(({ theme: e }) => ({
|
|
74
|
+
fontSize: e.typography.fontSize - 2,
|
|
75
|
+
color: e.palette.error.main,
|
|
76
|
+
paddingLeft: e.spacing(3),
|
|
77
|
+
paddingTop: e.spacing(1)
|
|
78
|
+
})), L = r("div")(() => ({
|
|
79
|
+
position: "absolute",
|
|
80
|
+
right: 0
|
|
81
|
+
})), R = (t) => {
|
|
82
|
+
let { points: n, content: r, sampleAnswer: i, mathMlOptions: a = {}, error: o, pluginOpts: s = {} } = t, c = `${n} ${n <= 1 ? "pt" : "pts"}`, l = A(i);
|
|
83
|
+
return /* @__PURE__ */ S("div", { children: [
|
|
84
|
+
/* @__PURE__ */ x(P, {
|
|
85
|
+
variant: "overline",
|
|
86
|
+
children: c
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ S(j, { children: [
|
|
89
|
+
/* @__PURE__ */ x(N, {}),
|
|
90
|
+
/* @__PURE__ */ x(M, { children: /* @__PURE__ */ x(C, {
|
|
91
|
+
error: o,
|
|
92
|
+
pluginProps: s,
|
|
93
|
+
markup: r,
|
|
94
|
+
onChange: t.onChange,
|
|
95
|
+
mathMlOptions: a
|
|
96
|
+
}) }),
|
|
97
|
+
/* @__PURE__ */ x(L, { children: /* @__PURE__ */ x(e, {
|
|
98
|
+
showSampleAnswer: l,
|
|
99
|
+
onChange: t.onMenuChange
|
|
100
|
+
}) })
|
|
101
|
+
] }),
|
|
102
|
+
o && /* @__PURE__ */ x(I, { children: o }),
|
|
103
|
+
!l && /* @__PURE__ */ S(F, { children: [/* @__PURE__ */ x(N, {
|
|
104
|
+
as: h,
|
|
105
|
+
variant: "overline",
|
|
106
|
+
children: "Sample Response"
|
|
107
|
+
}), /* @__PURE__ */ x(M, { children: /* @__PURE__ */ x(C, {
|
|
108
|
+
markup: i,
|
|
109
|
+
pluginProps: s,
|
|
110
|
+
onChange: t.onSampleChange,
|
|
111
|
+
mathMlOptions: a
|
|
112
|
+
}) })] })
|
|
113
|
+
] });
|
|
114
|
+
}, z = r("div")(({ theme: e }) => ({
|
|
115
|
+
backgroundColor: T[200],
|
|
116
|
+
borderWidth: 1,
|
|
117
|
+
borderStyle: "solid",
|
|
118
|
+
borderColor: T[300],
|
|
119
|
+
padding: e.spacing(2),
|
|
120
|
+
margin: e.spacing(1)
|
|
121
|
+
})), B = r(w)(({ theme: e }) => ({
|
|
122
|
+
width: "100%",
|
|
123
|
+
paddingTop: e.spacing(2.5),
|
|
124
|
+
marginBottom: e.spacing(2),
|
|
125
|
+
marginTop: e.spacing(1),
|
|
126
|
+
"& .MuiFormControl-root": { width: "100%" },
|
|
127
|
+
"& > .MuiFormLabel-root.MuiInputLabel-shrink": {
|
|
128
|
+
fontSize: e.typography.fontSize + 2,
|
|
129
|
+
transform: "translate(0, 1.5px) scale(0.75)"
|
|
130
|
+
}
|
|
131
|
+
})), V = r("div")(() => ({ display: "none" })), H = r("div")(({ theme: e }) => ({
|
|
132
|
+
paddingTop: e.spacing(1),
|
|
133
|
+
paddingBottom: e.spacing(1)
|
|
134
|
+
})), U = r(h)(({ theme: e }) => ({
|
|
135
|
+
paddingLeft: e.spacing(1),
|
|
136
|
+
margin: e.spacing(1)
|
|
137
|
+
})), W = class extends t.Component {
|
|
138
|
+
static propTypes = {
|
|
139
|
+
value: O,
|
|
140
|
+
config: n.object,
|
|
141
|
+
pluginOpts: n.object,
|
|
142
|
+
rubricless: n.bool,
|
|
143
|
+
onChange: n.func
|
|
144
|
+
};
|
|
145
|
+
static defaultProps = {};
|
|
146
|
+
dragEnd = (e) => {
|
|
147
|
+
if (!e.destination) return;
|
|
148
|
+
let { value: t, onChange: n } = this.props, r = D(t.points, e.source.index, e.destination.index), i = D(t.sampleAnswers, e.source.index, e.destination.index);
|
|
149
|
+
n({
|
|
150
|
+
...t,
|
|
151
|
+
points: r,
|
|
152
|
+
sampleAnswers: i
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
changeRubriclessInstruction = (e) => {
|
|
156
|
+
let { value: t, onChange: n } = this.props;
|
|
157
|
+
n({
|
|
158
|
+
...t,
|
|
159
|
+
rubriclessInstruction: e
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
changeMaxPoints = (e) => {
|
|
163
|
+
let { value: t, onChange: n, rubricless: r } = this.props, i = t.points.length - 1;
|
|
164
|
+
E("current", i, "new: ", e);
|
|
165
|
+
let a, o;
|
|
166
|
+
e > i && (a = d(e - i).map(() => "").concat(t.points), o = d(e - i).map(() => null).concat(t.sampleAnswers)), e < i && (E("less than"), a = u(t.points, e + 1), o = u(t.sampleAnswers, e + 1)), n(a && !r ? {
|
|
167
|
+
...t,
|
|
168
|
+
points: a,
|
|
169
|
+
sampleAnswers: o,
|
|
170
|
+
maxPoints: e
|
|
171
|
+
} : {
|
|
172
|
+
...t,
|
|
173
|
+
maxPoints: e
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
changeContent = (e, t, n) => {
|
|
177
|
+
if (E(`changeModel[${n}]:`, e, t), n !== "points" && n !== "sampleAnswers") return;
|
|
178
|
+
let { value: r, onChange: i } = this.props, a = r[n] && Array.from(r[n]);
|
|
179
|
+
a.splice(e, 1, t), E(`changeModel[${n}]:`, a), i({
|
|
180
|
+
...r,
|
|
181
|
+
[n]: a
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
excludeZeros = () => {
|
|
185
|
+
let { value: e, onChange: t } = this.props;
|
|
186
|
+
t({
|
|
187
|
+
...e,
|
|
188
|
+
excludeZero: !e.excludeZero
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
getPointForIndex = (e, t) => (t.excludeZero ? t.points.length - 1 + 1 : t.points.length - 1) - e;
|
|
192
|
+
getMaxPoint = (e) => e.excludeZero ? e.points.length : e.points.length - 1;
|
|
193
|
+
shouldRenderPoint = (e, t) => this.getPointForIndex(e, t) > 0 || !t.excludeZero;
|
|
194
|
+
onPointMenuChange = (e, t) => {
|
|
195
|
+
if (t === "sample") {
|
|
196
|
+
let { value: t } = this.props;
|
|
197
|
+
A(Array.from(t.sampleAnswers || [])[e]) ? this.changeContent(e, "", "sampleAnswers") : this.changeContent(e, null, "sampleAnswers");
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
render() {
|
|
201
|
+
let { value: e, mathMlOptions: t = {}, config: n = {}, rubricless: r = !1, pluginOpts: i = {} } = this.props, { excludeZeroEnabled: a = !0, maxPointsEnabled: o = !0, errors: s = {}, rubriclessInstructionEnabled: c = !1, maxPoints: l = 10 } = e || {}, { rubriclessInstruction: u = {}, maxMaxPoints: d = 10 } = n || {}, { pointsDescriptorsErrors: h } = s || {};
|
|
202
|
+
e && Number.isFinite(e.maxPoints) && console.warn("maxPoints is deprecated - remove from model");
|
|
203
|
+
let g = r ? l : e.excludeZero ? e.points.length : e.points.length - 1;
|
|
204
|
+
return /* @__PURE__ */ S("div", { children: [
|
|
205
|
+
/* @__PURE__ */ x(U, {
|
|
206
|
+
variant: "h5",
|
|
207
|
+
children: "Rubric"
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ S(p, {
|
|
210
|
+
row: !0,
|
|
211
|
+
children: [o && /* @__PURE__ */ x(k, {
|
|
212
|
+
max: d < 100 ? d : 100,
|
|
213
|
+
value: g,
|
|
214
|
+
onChange: this.changeMaxPoints,
|
|
215
|
+
pluginOpts: i
|
|
216
|
+
}), a && /* @__PURE__ */ x(m, {
|
|
217
|
+
label: "Exclude zeros",
|
|
218
|
+
control: /* @__PURE__ */ x(f, {
|
|
219
|
+
checked: e.excludeZero,
|
|
220
|
+
onChange: this.excludeZeros
|
|
221
|
+
})
|
|
222
|
+
})]
|
|
223
|
+
}),
|
|
224
|
+
c && r && /* @__PURE__ */ x(B, {
|
|
225
|
+
label: u.label,
|
|
226
|
+
children: /* @__PURE__ */ x(C, {
|
|
227
|
+
markup: e.rubriclessInstruction || "",
|
|
228
|
+
onChange: this.changeRubriclessInstruction,
|
|
229
|
+
pluginProps: i,
|
|
230
|
+
nonEmpty: !1,
|
|
231
|
+
disableUnderline: !0,
|
|
232
|
+
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
233
|
+
mathMlOptions: t,
|
|
234
|
+
autoWidthToolbar: !0
|
|
235
|
+
})
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ x("div", { children: r ? /* @__PURE__ */ x(V, {}) : /* @__PURE__ */ x(z, { children: /* @__PURE__ */ x(_, {
|
|
238
|
+
onDragEnd: this.dragEnd,
|
|
239
|
+
children: /* @__PURE__ */ x(y, {
|
|
240
|
+
droppableId: "droppable",
|
|
241
|
+
children: (n) => /* @__PURE__ */ S("div", {
|
|
242
|
+
...n.droppableProps,
|
|
243
|
+
ref: n.innerRef,
|
|
244
|
+
children: [e.points.map((n, r) => this.shouldRenderPoint(r, e) && /* @__PURE__ */ x(v, {
|
|
245
|
+
index: r,
|
|
246
|
+
draggableId: r.toString(),
|
|
247
|
+
children: (a) => /* @__PURE__ */ x(H, {
|
|
248
|
+
ref: a.innerRef,
|
|
249
|
+
...a.draggableProps,
|
|
250
|
+
...a.dragHandleProps,
|
|
251
|
+
children: /* @__PURE__ */ x(R, {
|
|
252
|
+
points: this.getPointForIndex(r, e),
|
|
253
|
+
content: n,
|
|
254
|
+
error: h && h[e.points.length - 1 - r],
|
|
255
|
+
sampleAnswer: e.sampleAnswers && e.sampleAnswers[r],
|
|
256
|
+
onChange: (e) => this.changeContent(r, e, "points"),
|
|
257
|
+
onSampleChange: (e) => this.changeContent(r, e, "sampleAnswers"),
|
|
258
|
+
onMenuChange: (e) => this.onPointMenuChange(r, e),
|
|
259
|
+
mathMlOptions: t,
|
|
260
|
+
pluginOpts: i
|
|
261
|
+
})
|
|
262
|
+
})
|
|
263
|
+
}, `${n.points}-${r}`)), n.placeholder]
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
}) }) })
|
|
267
|
+
] });
|
|
268
|
+
}
|
|
269
|
+
}, G = (e) => {
|
|
270
|
+
let { rubricless: t = !1, config: n = {}, pluginOpts: r = {} } = e || {}, i = Array.from(e.value.points || []).reverse(), a = Array.from(e.value.sampleAnswers || []).reverse();
|
|
271
|
+
return i.length > a.length && (a = d(i.length - a.length).map(() => null).concat(a)), /* @__PURE__ */ x(W, {
|
|
272
|
+
value: {
|
|
273
|
+
...e.value,
|
|
274
|
+
points: i,
|
|
275
|
+
sampleAnswers: a
|
|
276
|
+
},
|
|
277
|
+
config: n,
|
|
278
|
+
onChange: (t) => {
|
|
279
|
+
e.onChange({
|
|
280
|
+
...t,
|
|
281
|
+
points: Array.from(t.points || []).reverse(),
|
|
282
|
+
sampleAnswers: Array.from(t.sampleAnswers || []).reverse()
|
|
283
|
+
});
|
|
284
|
+
},
|
|
285
|
+
rubricless: t,
|
|
286
|
+
pluginOpts: r
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
G.propTypes = {
|
|
290
|
+
value: O,
|
|
291
|
+
config: n.object,
|
|
292
|
+
pluginOpts: n.object,
|
|
293
|
+
rubricless: n.bool,
|
|
294
|
+
getIndex: n.func,
|
|
295
|
+
onChange: n.func
|
|
296
|
+
};
|
|
297
|
+
//#endregion
|
|
298
|
+
export { R as PointConfig, W as RawAuthoring, O as RubricType, G as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/rubric/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 Authoring from './authoring.js';
|
|
10
|
+
declare const RUBRIC_TYPES: {
|
|
11
|
+
SIMPLE_RUBRIC: string;
|
|
12
|
+
MULTI_TRAIT_RUBRIC: string;
|
|
13
|
+
RUBRICLESS: string;
|
|
14
|
+
};
|
|
15
|
+
export { Authoring, RUBRIC_TYPES };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/rubric/src/point-menu.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 PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
export declare class IconMenu extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
opts: PropTypes.Requireable<object>;
|
|
14
|
+
onClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
15
|
+
};
|
|
16
|
+
constructor(props: any);
|
|
17
|
+
handleClick: (event: any) => void;
|
|
18
|
+
handleRequestClose: () => void;
|
|
19
|
+
render(): React.JSX.Element;
|
|
20
|
+
}
|
|
21
|
+
export default class PointMenu extends React.Component {
|
|
22
|
+
static propTypes: {
|
|
23
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
24
|
+
showSampleAnswer: PropTypes.Validator<boolean>;
|
|
25
|
+
};
|
|
26
|
+
render(): React.JSX.Element;
|
|
27
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import n from "@mui/material/MenuItem";
|
|
4
|
+
import * as r from "@pie-lib/render-ui";
|
|
5
|
+
import { InlineMenu as i } from "@pie-lib/render-ui";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import s from "@mui/icons-material/MoreVert";
|
|
8
|
+
import c from "@mui/icons-material/MoreHoriz";
|
|
9
|
+
import l from "@mui/material/IconButton";
|
|
10
|
+
//#region src/point-menu.tsx
|
|
11
|
+
function u(e) {
|
|
12
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
13
|
+
}
|
|
14
|
+
function d(e, t) {
|
|
15
|
+
return !e || u(e) ? e : u(e.default) ? e.default : t && u(e[t]) ? e[t] : t && u(e[t]?.default) ? e[t].default : e;
|
|
16
|
+
}
|
|
17
|
+
var f = d(i, "InlineMenu") || d(h.InlineMenu, "InlineMenu"), p = r, m = p.default, h = m && typeof m == "object" ? m : p, g = class extends e.Component {
|
|
18
|
+
static propTypes = {
|
|
19
|
+
opts: t.object,
|
|
20
|
+
onClick: t.func.isRequired
|
|
21
|
+
};
|
|
22
|
+
constructor(e) {
|
|
23
|
+
super(e), this.state = {
|
|
24
|
+
anchorEl: void 0,
|
|
25
|
+
open: !1
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
handleClick = (e) => this.setState({
|
|
29
|
+
open: !0,
|
|
30
|
+
anchorEl: e.currentTarget
|
|
31
|
+
});
|
|
32
|
+
handleRequestClose = () => this.setState({ open: !1 });
|
|
33
|
+
render() {
|
|
34
|
+
let { opts: e, onClick: t } = this.props, { open: r, anchorEl: i } = this.state, u = Object.keys(e) || [], d = (e) => () => {
|
|
35
|
+
t(e), this.handleRequestClose();
|
|
36
|
+
}, p = r ? "inherit" : "disabled";
|
|
37
|
+
return /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("div", {
|
|
38
|
+
onClick: this.handleClick,
|
|
39
|
+
children: /* @__PURE__ */ a(l, {
|
|
40
|
+
size: "large",
|
|
41
|
+
children: a(r ? s : c, { color: p })
|
|
42
|
+
})
|
|
43
|
+
}), /* @__PURE__ */ a(f, {
|
|
44
|
+
id: "point-menu",
|
|
45
|
+
anchorEl: i,
|
|
46
|
+
open: r,
|
|
47
|
+
onClose: this.handleRequestClose,
|
|
48
|
+
style: { transform: "translate(-15px, -15px)" },
|
|
49
|
+
transformOrigin: {
|
|
50
|
+
vertical: "center",
|
|
51
|
+
horizontal: "right"
|
|
52
|
+
},
|
|
53
|
+
children: u.map((t, r) => /* @__PURE__ */ a(n, {
|
|
54
|
+
onClick: d(t),
|
|
55
|
+
children: e[t]
|
|
56
|
+
}, r))
|
|
57
|
+
})] });
|
|
58
|
+
}
|
|
59
|
+
}, _ = class extends e.Component {
|
|
60
|
+
static propTypes = {
|
|
61
|
+
onChange: t.func.isRequired,
|
|
62
|
+
showSampleAnswer: t.bool.isRequired
|
|
63
|
+
};
|
|
64
|
+
render() {
|
|
65
|
+
let { onChange: e, showSampleAnswer: t } = this.props;
|
|
66
|
+
return /* @__PURE__ */ a(g, {
|
|
67
|
+
onClick: (t) => e(t),
|
|
68
|
+
opts: { sample: t ? "Provide Sample Response" : "Remove Sample Response" }
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { g as IconMenu, _ as default };
|
package/package.json
CHANGED
|
@@ -1,24 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/rubric",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "3.0.0-next.36",
|
|
4
|
+
"description": "React implementation of @pie-lib/rubric synced from pie-lib",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/pie-framework/pie-elements-ng.git",
|
|
8
|
+
"directory": "packages/lib-react/rubric"
|
|
6
9
|
},
|
|
7
|
-
"main": "lib/index.js",
|
|
8
|
-
"module": "src/index.js",
|
|
9
|
-
"repository": "pie-framework/pie-lib",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@emotion/react": "^11.14.0",
|
|
12
12
|
"@emotion/styled": "^11.14.1",
|
|
13
13
|
"@hello-pangea/dnd": "^18.0.1",
|
|
14
14
|
"@mui/icons-material": "^7.3.4",
|
|
15
15
|
"@mui/material": "^7.3.4",
|
|
16
|
-
"@pie-lib/editable-html-tip-tap": "
|
|
16
|
+
"@pie-lib/editable-html-tip-tap": "3.0.0-next.36",
|
|
17
17
|
"debug": "^4.1.1",
|
|
18
|
-
"lodash-es": "^4.17.23",
|
|
19
18
|
"prop-types": "^15.7.2",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
19
|
+
"@pie-element/shared-lodash": "0.1.1-next.1",
|
|
20
|
+
"@pie-lib/config-ui": "14.0.0-next.36",
|
|
21
|
+
"@pie-lib/render-ui": "6.2.0-next.42"
|
|
22
22
|
},
|
|
23
|
-
"
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "bun x vite build && bun x tsc --emitDeclarationOnly",
|
|
38
|
+
"dev": "bun x vite",
|
|
39
|
+
"test": "bun x vitest run"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": "^18.0.0",
|
|
43
|
+
"react-dom": "^18.0.0"
|
|
44
|
+
}
|
|
24
45
|
}
|
package/CHANGELOG.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|