@pie-element/inline-dropdown 10.1.2-next.1 → 10.1.2
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 +1082 -0
- package/CHANGELOG.md +2192 -0
- package/LICENSE.md +5 -0
- package/README.md +1 -0
- package/configure/CHANGELOG.json +647 -0
- package/configure/CHANGELOG.md +1949 -0
- package/configure/lib/defaults.js +192 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +135 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/inline-dropdown-toolbar.js +456 -0
- package/configure/lib/inline-dropdown-toolbar.js.map +1 -0
- package/configure/lib/main.js +612 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/markupUtils.js +50 -0
- package/configure/lib/markupUtils.js.map +1 -0
- package/configure/lib/response-area.js +48 -0
- package/configure/lib/response-area.js.map +1 -0
- package/configure/lib/utils.js +22 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +24 -0
- package/controller/CHANGELOG.json +467 -0
- package/controller/CHANGELOG.md +1283 -0
- package/controller/lib/defaults.js +25 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +295 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +32 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +16 -0
- package/docs/config-schema.json +2854 -0
- package/docs/config-schema.json.md +2106 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +76 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +11 -0
- package/docs/pie-schema.json +1152 -0
- package/docs/pie-schema.json.md +814 -0
- package/lib/index.js +85 -0
- package/lib/index.js.map +1 -0
- package/lib/inline-dropdown.js +176 -0
- package/lib/inline-dropdown.js.map +1 -0
- package/package.json +21 -86
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/defaults.d.ts +0 -194
- package/dist/author/defaults.js +0 -130
- package/dist/author/index.d.ts +0 -43
- package/dist/author/index.js +0 -83
- package/dist/author/inline-dropdown-toolbar.d.ts +0 -48
- package/dist/author/inline-dropdown-toolbar.js +0 -268
- package/dist/author/main.d.ts +0 -49
- package/dist/author/main.js +0 -379
- package/dist/author/markupUtils.d.ts +0 -12
- package/dist/author/markupUtils.js +0 -23
- package/dist/author/response-area.d.ts +0 -20
- package/dist/author/response-area.js +0 -32
- package/dist/author/utils.d.ts +0 -10
- package/dist/author/utils.js +0 -10
- package/dist/browser/Close-CMvmRhfL.js +0 -9024
- package/dist/browser/Close-CMvmRhfL.js.map +0 -1
- package/dist/browser/author/index.js +0 -40578
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/controller/index.js +0 -196
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -2714
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-CAsDMEWi.js +0 -133
- package/dist/browser/dist-CAsDMEWi.js.map +0 -1
- package/dist/browser/inline-dropdown.css +0 -2
- package/dist/controller/defaults.d.ts +0 -27
- package/dist/controller/defaults.js +0 -21
- package/dist/controller/index.d.ts +0 -54
- package/dist/controller/index.js +0 -124
- package/dist/controller/utils.d.ts +0 -12
- package/dist/controller/utils.js +0 -13
- package/dist/delivery/index.d.ts +0 -20
- package/dist/delivery/index.js +0 -60
- package/dist/delivery/inline-dropdown.d.ts +0 -38
- package/dist/delivery/inline-dropdown.js +0 -109
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -148
- package/dist/index.js +0 -2
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/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
|
-
alternateResponse: {};
|
|
11
|
-
choiceRationaleEnabled: boolean;
|
|
12
|
-
choices: {};
|
|
13
|
-
disabled: boolean;
|
|
14
|
-
displayType: string;
|
|
15
|
-
markup: string;
|
|
16
|
-
mode: string;
|
|
17
|
-
prompt: string;
|
|
18
|
-
promptEnabled: boolean;
|
|
19
|
-
rationale: string;
|
|
20
|
-
rationaleEnabled: boolean;
|
|
21
|
-
shuffle: boolean;
|
|
22
|
-
studentInstructionsEnabled: boolean;
|
|
23
|
-
teacherInstructions: string;
|
|
24
|
-
teacherInstructionsEnabled: boolean;
|
|
25
|
-
toolbarEditorPosition: string;
|
|
26
|
-
};
|
|
27
|
-
export default _default;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//#region src/controller/defaults.ts
|
|
2
|
-
var e = {
|
|
3
|
-
alternateResponse: {},
|
|
4
|
-
choiceRationaleEnabled: !0,
|
|
5
|
-
choices: {},
|
|
6
|
-
disabled: !1,
|
|
7
|
-
displayType: "block",
|
|
8
|
-
markup: "",
|
|
9
|
-
mode: "gather",
|
|
10
|
-
prompt: "",
|
|
11
|
-
promptEnabled: !0,
|
|
12
|
-
rationale: "",
|
|
13
|
-
rationaleEnabled: !0,
|
|
14
|
-
shuffle: !0,
|
|
15
|
-
studentInstructionsEnabled: !0,
|
|
16
|
-
teacherInstructions: "",
|
|
17
|
-
teacherInstructionsEnabled: !0,
|
|
18
|
-
toolbarEditorPosition: "bottom"
|
|
19
|
-
};
|
|
20
|
-
//#endregion
|
|
21
|
-
export { e as default };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/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 normalize: (question: any) => any;
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @param {*} question
|
|
13
|
-
* @param {*} session
|
|
14
|
-
* @param {*} env
|
|
15
|
-
* @param {*} updateSession - optional - a function that will set the properties passed into it on the session.
|
|
16
|
-
*/
|
|
17
|
-
export declare function model(question: any, session: any, env: any, updateSession: any): Promise<{
|
|
18
|
-
disabled: boolean;
|
|
19
|
-
mode: any;
|
|
20
|
-
prompt: any;
|
|
21
|
-
displayType: any;
|
|
22
|
-
markup: any;
|
|
23
|
-
choices: {};
|
|
24
|
-
feedback: {};
|
|
25
|
-
responseCorrect: boolean | undefined;
|
|
26
|
-
rationale: any;
|
|
27
|
-
teacherInstructions: any;
|
|
28
|
-
language: any;
|
|
29
|
-
extraCSSRules: any;
|
|
30
|
-
}>;
|
|
31
|
-
export declare const getScore: (config: any, session: any) => number;
|
|
32
|
-
/**
|
|
33
|
-
* Generates detailed trace log for scoring evaluation
|
|
34
|
-
* @param {Object} model - the question model
|
|
35
|
-
* @param {Object} session - the student session
|
|
36
|
-
* @param {Object} env - the environment
|
|
37
|
-
* @returns {Array} traceLog - array of trace messages
|
|
38
|
-
*/
|
|
39
|
-
export declare const getLogTrace: (model: any, session: any, env: any) => string[];
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* The score is partial by default for checkbox mode, allOrNothing for radio mode.
|
|
43
|
-
* To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =
|
|
44
|
-
* false. the value in `env` will override the value in `model`.
|
|
45
|
-
* @param {Object} model - the main model
|
|
46
|
-
* @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)
|
|
47
|
-
* @param {*} session
|
|
48
|
-
* @param {Object} env
|
|
49
|
-
* @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides
|
|
50
|
-
* `model.partialScoring`.
|
|
51
|
-
*/
|
|
52
|
-
export declare function outcome(model: any, session: any, env?: {}): Promise<unknown>;
|
|
53
|
-
export declare const createCorrectResponseSession: (question: any, env: any) => Promise<unknown>;
|
|
54
|
-
export declare const validate: (model?: {}, config?: {}) => {};
|
package/dist/controller/index.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import e from "./defaults.js";
|
|
2
|
-
import { getAllCorrectResponses as t } from "./utils.js";
|
|
3
|
-
import { isEmpty as n, map as r, reduce as i } from "@pie-element/shared-lodash";
|
|
4
|
-
import { getShuffledChoices as a, lockChoices as o, partialScoring as s } from "@pie-element/shared-controller-utils";
|
|
5
|
-
//#region src/controller/index.ts
|
|
6
|
-
var c = (e) => e ? "correct" : "incorrect", l = (t) => ({
|
|
7
|
-
...e,
|
|
8
|
-
...t
|
|
9
|
-
});
|
|
10
|
-
async function u(e, s, u, f) {
|
|
11
|
-
let p = l(e), { value: m = {} } = s || {}, h = i(p.choices, (e, t, n) => (e[n] = r(t, (e) => e), e), {}), g = {};
|
|
12
|
-
if (u.mode === "evaluate") {
|
|
13
|
-
let e = t(p), n = Object.keys(e).length, r = 0;
|
|
14
|
-
for (let t = 0; t < n; t++) {
|
|
15
|
-
let a = i(e, (e, n, r) => {
|
|
16
|
-
let i = m && m[r] || "", a = n[t] || "", o = i && a && a === i;
|
|
17
|
-
return e.feedback[r] = c(o), o && (e.correctResponses += 1), e;
|
|
18
|
-
}, {
|
|
19
|
-
correctResponses: 0,
|
|
20
|
-
feedback: {}
|
|
21
|
-
});
|
|
22
|
-
if (a.correctResponses >= r && (r = a.correctResponses, g = a.feedback), a.correctResponses === n) break;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (!o(p, s, u)) {
|
|
26
|
-
let e = {}, t = Object.keys(h), r = (t) => (n, r, i) => new Promise((n) => {
|
|
27
|
-
e[t] = i.shuffledValues, n();
|
|
28
|
-
}), i;
|
|
29
|
-
for (i = 0; i < t.length; i++) {
|
|
30
|
-
let e = t[i], n = s?.shuffledValues?.[e];
|
|
31
|
-
h[e] = await a(h[e], { shuffledValues: Array.isArray(n) ? n : [] }, r(e), "value");
|
|
32
|
-
}
|
|
33
|
-
n(e) || s && f && typeof f == "function" && f(s.id, s.element, { shuffledValues: e }).catch((e) => {
|
|
34
|
-
console.error("update session failed", e);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
let _ = null, v = null, y = (Object.keys(h) || []).reduce((e, t) => (e[t] = (h[t] || []).map((e) => ({
|
|
38
|
-
...e,
|
|
39
|
-
rationale: null
|
|
40
|
-
})), e), {});
|
|
41
|
-
return u.role === "instructor" && (u.mode === "view" || u.mode === "evaluate") ? (v = p.rationaleEnabled ? p.rationale : null, _ = p.teacherInstructionsEnabled ? p.teacherInstructions : null, h = p.choiceRationaleEnabled ? p.choices : y) : (v = null, _ = null, h = y), {
|
|
42
|
-
disabled: u.mode !== "gather",
|
|
43
|
-
mode: u.mode,
|
|
44
|
-
prompt: p.promptEnabled ? p.prompt : null,
|
|
45
|
-
displayType: p.displayType,
|
|
46
|
-
markup: p.markup,
|
|
47
|
-
choices: h,
|
|
48
|
-
feedback: g,
|
|
49
|
-
responseCorrect: u.mode === "evaluate" ? d(p, s) === 1 : void 0,
|
|
50
|
-
rationale: v,
|
|
51
|
-
teacherInstructions: _,
|
|
52
|
-
language: p.language,
|
|
53
|
-
extraCSSRules: p.extraCSSRules
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
var d = (e, n) => {
|
|
57
|
-
let { value: r = {} } = n || {}, a = e && e.choices ? Object.keys(e.choices).length : 0, o = t(e), s = 0;
|
|
58
|
-
for (let e = 0; e < a; e++) {
|
|
59
|
-
let t = i(o, (t, n, i) => {
|
|
60
|
-
let a = r && r[i] || "", o = n[e] || "";
|
|
61
|
-
return o && a && o === a ? t : t - 1;
|
|
62
|
-
}, a);
|
|
63
|
-
if (t > s && (s = t), t === a) break;
|
|
64
|
-
}
|
|
65
|
-
let c = (s / a).toFixed(2);
|
|
66
|
-
return parseFloat(c);
|
|
67
|
-
}, f = (e, n, r) => {
|
|
68
|
-
let i = [], { value: a = {} } = n || {}, o = t(e), c = Object.keys(o), l = c.length;
|
|
69
|
-
if (i.push(`${l} dropdown response area(s) defined in this question.`), a && Object.keys(a).length > 0) {
|
|
70
|
-
let e = Object.entries(a).filter(([e, t]) => t && t.trim()).length;
|
|
71
|
-
i.push(`Student selected options in ${e} out of ${l} dropdown(s).`), c.forEach((e) => {
|
|
72
|
-
let t = a && a[e] || "", n = o[e] || [];
|
|
73
|
-
t.trim() ? i.push(`Dropdown ${parseInt(e) + 1}: student selected '${t}' (correct options: [${n.map((e) => `'${e}'`).join(", ")}]).`) : i.push(`Dropdown ${parseInt(e) + 1}: no selection made (correct options: [${n.map((e) => `'${e}'`).join(", ")}]).`);
|
|
74
|
-
});
|
|
75
|
-
} else i.push("Student did not make any selections in the dropdowns.");
|
|
76
|
-
let u = s.enabled(e, r);
|
|
77
|
-
i.push(`Scoring method: ${u ? "partial scoring" : "all-or-nothing scoring"}.`);
|
|
78
|
-
let f = d(e, n);
|
|
79
|
-
return i.push(`Final score: ${f}.`), i;
|
|
80
|
-
};
|
|
81
|
-
function p(e, t, r = {}) {
|
|
82
|
-
return new Promise((i) => {
|
|
83
|
-
if (!t || n(t)) i({
|
|
84
|
-
score: 0,
|
|
85
|
-
empty: !0,
|
|
86
|
-
traceLog: ["Student did not make any selections in the dropdowns. Score is 0."]
|
|
87
|
-
});
|
|
88
|
-
else {
|
|
89
|
-
let n = f(e, t, r), a = d(e, t);
|
|
90
|
-
i({
|
|
91
|
-
score: s.enabled(e, r) ? a : Math.floor(a),
|
|
92
|
-
empty: !1,
|
|
93
|
-
traceLog: n
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
var m = (e, t) => new Promise((n) => {
|
|
99
|
-
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
100
|
-
let { choices: t } = e, r = {};
|
|
101
|
-
t && Object.keys(t).forEach((e, n) => {
|
|
102
|
-
let i = t[e] && t[e].filter((e) => e.correct);
|
|
103
|
-
r[n] = i && i[0].value;
|
|
104
|
-
}), n({
|
|
105
|
-
id: "1",
|
|
106
|
-
value: r
|
|
107
|
-
});
|
|
108
|
-
} else n(null);
|
|
109
|
-
}), h = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), g = (e = {}, t = {}) => {
|
|
110
|
-
let { markup: n, choices: r } = e, { maxResponseAreas: i, maxResponseAreaChoices: a } = t, o = {};
|
|
111
|
-
[
|
|
112
|
-
"teacherInstructions",
|
|
113
|
-
"prompt",
|
|
114
|
-
"rationale"
|
|
115
|
-
].forEach((n) => {
|
|
116
|
-
t[n]?.required && !h(e[n]) && (o[n] = "This field is required.");
|
|
117
|
-
});
|
|
118
|
-
let s = ((n || "").match(/\{\{(\d+)\}\}/g) || []).length;
|
|
119
|
-
return s > i ? o.responseAreasError = `No more than ${i} response areas should be defined.` : s < 1 && (o.responseAreasError = "There should be defined at least 1 response area."), (Object.keys(r) || []).forEach((e) => {
|
|
120
|
-
r[e] && r[e].length > a && (o.responseAreaChoicesError = `No more than ${a} choices per response area should be defined.`);
|
|
121
|
-
}), o;
|
|
122
|
-
};
|
|
123
|
-
//#endregion
|
|
124
|
-
export { m as createCorrectResponseSession, f as getLogTrace, d as getScore, u as model, l as normalize, p as outcome, g as validate };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/controller/src/utils.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 getAllCorrectResponses: ({ choices, alternateResponse }: {
|
|
10
|
-
choices: any;
|
|
11
|
-
alternateResponse: any;
|
|
12
|
-
}) => {};
|
package/dist/controller/utils.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { forEach as e } from "@pie-element/shared-lodash";
|
|
2
|
-
//#region src/controller/utils.ts
|
|
3
|
-
var t = ({ choices: t, alternateResponse: n }) => {
|
|
4
|
-
n ||= {};
|
|
5
|
-
let r = {};
|
|
6
|
-
return e(t, (e, t) => {
|
|
7
|
-
r[t] || (r[t] = []), e && e.forEach((e) => {
|
|
8
|
-
e.correct && (r[t].push(e.value), n[t] && (r[t] = [...r[t], ...n[t]]));
|
|
9
|
-
});
|
|
10
|
-
}), r;
|
|
11
|
-
};
|
|
12
|
-
//#endregion
|
|
13
|
-
export { t as getAllCorrectResponses };
|
package/dist/delivery/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/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 default class RootInlineDropdown extends HTMLElement {
|
|
10
|
-
constructor();
|
|
11
|
-
set model(m: any);
|
|
12
|
-
set session(s: any);
|
|
13
|
-
get session(): any;
|
|
14
|
-
setLangAttribute(): void;
|
|
15
|
-
_render: any;
|
|
16
|
-
dispatchChangedEvent: any;
|
|
17
|
-
changeSession: any;
|
|
18
|
-
connectedCallback(): void;
|
|
19
|
-
disconnectedCallback(): void;
|
|
20
|
-
}
|
package/dist/delivery/index.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import e from "./inline-dropdown.js";
|
|
2
|
-
import t from "react";
|
|
3
|
-
import { createRoot as n } from "react-dom/client";
|
|
4
|
-
import { ModelSetEvent as r, SessionChangedEvent as i } from "@pie-element/shared-player-events";
|
|
5
|
-
import { renderMath as a } from "@pie-element/shared-math-rendering-mathjax";
|
|
6
|
-
//#region src/delivery/index.ts
|
|
7
|
-
var o = class extends HTMLElement {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(), this._model = null, this._session = null, this._root = null;
|
|
10
|
-
}
|
|
11
|
-
set model(e) {
|
|
12
|
-
this._model = e, this.dispatchEvent(new r(this.tagName.toLowerCase(), this.session && !!this.session.value, !!this._model)), this._render();
|
|
13
|
-
}
|
|
14
|
-
set session(e) {
|
|
15
|
-
this._session = e, this._render();
|
|
16
|
-
}
|
|
17
|
-
get session() {
|
|
18
|
-
return this._session;
|
|
19
|
-
}
|
|
20
|
-
setLangAttribute() {
|
|
21
|
-
let e = this._model && typeof this._model.language ? this._model.language : "", t = e ? e.slice(0, 2) : "en";
|
|
22
|
-
this.setAttribute("lang", t);
|
|
23
|
-
}
|
|
24
|
-
_render = () => {
|
|
25
|
-
if (this._model && this._session) {
|
|
26
|
-
let r = t.createElement(e, {
|
|
27
|
-
model: this._model,
|
|
28
|
-
prompt: this._model.prompt,
|
|
29
|
-
rationale: this._model.rationale,
|
|
30
|
-
teacherInstructions: this._model.teacherInstructions,
|
|
31
|
-
disabled: this._model.disabled,
|
|
32
|
-
displayType: this._model.displayType,
|
|
33
|
-
markup: this._model.markup,
|
|
34
|
-
mode: this._model.mode,
|
|
35
|
-
choices: this._model.choices,
|
|
36
|
-
value: this._session.value,
|
|
37
|
-
feedback: this._model.feedback,
|
|
38
|
-
language: this._model.language,
|
|
39
|
-
onChange: this.changeSession
|
|
40
|
-
});
|
|
41
|
-
this.setLangAttribute(), this._root ||= n(this), this._root.render(r), queueMicrotask(() => {
|
|
42
|
-
a(this);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
dispatchChangedEvent = () => {
|
|
47
|
-
this.dispatchEvent(new i(this.tagName.toLowerCase(), this.session && !!this.session.value));
|
|
48
|
-
};
|
|
49
|
-
changeSession = (e) => {
|
|
50
|
-
this.session.value = e, this.dispatchChangedEvent(), this._render();
|
|
51
|
-
};
|
|
52
|
-
connectedCallback() {
|
|
53
|
-
this.setAttribute("aria-label", "Inline Dropdown Question"), this.setAttribute("role", "region"), this._render();
|
|
54
|
-
}
|
|
55
|
-
disconnectedCallback() {
|
|
56
|
-
this._root && this._root.unmount();
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
//#endregion
|
|
60
|
-
export { o as default };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/src/inline-dropdown.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 InlineDropdown extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
prompt: PropTypes.Requireable<string>;
|
|
14
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
15
|
-
markup: PropTypes.Requireable<string>;
|
|
16
|
-
mode: PropTypes.Requireable<string>;
|
|
17
|
-
displayType: PropTypes.Requireable<string>;
|
|
18
|
-
rationale: PropTypes.Requireable<string>;
|
|
19
|
-
teacherInstructions: PropTypes.Requireable<string>;
|
|
20
|
-
model: PropTypes.Validator<object>;
|
|
21
|
-
choices: PropTypes.Requireable<object>;
|
|
22
|
-
value: PropTypes.Requireable<object>;
|
|
23
|
-
feedback: PropTypes.Requireable<object>;
|
|
24
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
-
language: PropTypes.Requireable<string>;
|
|
26
|
-
};
|
|
27
|
-
static defaultProps: {
|
|
28
|
-
value: {};
|
|
29
|
-
};
|
|
30
|
-
state: {
|
|
31
|
-
showCorrectAnswer: boolean;
|
|
32
|
-
};
|
|
33
|
-
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
34
|
-
componentDidUpdate(): void;
|
|
35
|
-
toggleShowCorrect: any;
|
|
36
|
-
render(): React.JSX.Element;
|
|
37
|
-
}
|
|
38
|
-
export default InlineDropdown;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import { renderMath as t } from "@pie-element/shared-math-rendering-mathjax";
|
|
3
|
-
import n from "react-dom";
|
|
4
|
-
import r from "prop-types";
|
|
5
|
-
import { isEmpty as i } from "@pie-element/shared-lodash";
|
|
6
|
-
import a from "@pie-lib/correct-answer-toggle";
|
|
7
|
-
import { InlineDropdown as o } from "@pie-lib/mask-markup";
|
|
8
|
-
import * as s from "@pie-lib/render-ui";
|
|
9
|
-
import { Collapsible as c, PreviewPrompt as l, UiLayout as u, color as d, hasMedia as f, hasText as p } from "@pie-lib/render-ui";
|
|
10
|
-
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
|
-
import { styled as g } from "@mui/material/styles";
|
|
12
|
-
//#region src/delivery/inline-dropdown.tsx
|
|
13
|
-
function _(e) {
|
|
14
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
15
|
-
}
|
|
16
|
-
function v(e, t) {
|
|
17
|
-
return !e || _(e) ? e : _(e.default) ? e.default : t && _(e[t]) ? e[t] : t && _(e[t]?.default) ? e[t].default : e;
|
|
18
|
-
}
|
|
19
|
-
var y = v(u, "UiLayout") || v(w.UiLayout, "UiLayout"), b = v(l, "PreviewPrompt") || v(w.PreviewPrompt, "PreviewPrompt"), x = v(c, "Collapsible") || v(w.Collapsible, "Collapsible"), S = s, C = S.default, w = C && typeof C == "object" ? C : S, T = g(y)({
|
|
20
|
-
color: d.text(),
|
|
21
|
-
backgroundColor: d.background()
|
|
22
|
-
}), E = g(x)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), D = g("div")(({ theme: e }) => ({ "&:not(:last-child)": { marginBottom: e.spacing(2) } })), O = g("div")({
|
|
23
|
-
display: "flex",
|
|
24
|
-
whiteSpace: "break-spaces"
|
|
25
|
-
}), k = g("div")(({ correct: e }) => ({
|
|
26
|
-
display: "flex",
|
|
27
|
-
...e ? { color: d.correct() } : { color: d.incorrectWithIcon() }
|
|
28
|
-
})), A = g("h2")({
|
|
29
|
-
position: "absolute",
|
|
30
|
-
left: "-10000px",
|
|
31
|
-
top: "auto",
|
|
32
|
-
width: "1px",
|
|
33
|
-
height: "1px",
|
|
34
|
-
overflow: "hidden"
|
|
35
|
-
}), j = class extends e.Component {
|
|
36
|
-
static propTypes = {
|
|
37
|
-
prompt: r.string,
|
|
38
|
-
disabled: r.bool,
|
|
39
|
-
markup: r.string,
|
|
40
|
-
mode: r.string,
|
|
41
|
-
displayType: r.string,
|
|
42
|
-
rationale: r.string,
|
|
43
|
-
teacherInstructions: r.string,
|
|
44
|
-
model: r.object.isRequired,
|
|
45
|
-
choices: r.object,
|
|
46
|
-
value: r.object,
|
|
47
|
-
feedback: r.object,
|
|
48
|
-
onChange: r.func,
|
|
49
|
-
language: r.string
|
|
50
|
-
};
|
|
51
|
-
static defaultProps = { value: {} };
|
|
52
|
-
state = { showCorrectAnswer: !1 };
|
|
53
|
-
UNSAFE_componentWillReceiveProps(e) {
|
|
54
|
-
i(e.feedback) && this.setState({ showCorrectAnswer: !1 });
|
|
55
|
-
}
|
|
56
|
-
componentDidUpdate() {
|
|
57
|
-
t(n.findDOMNode(this));
|
|
58
|
-
}
|
|
59
|
-
toggleShowCorrect = () => {
|
|
60
|
-
this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });
|
|
61
|
-
};
|
|
62
|
-
render() {
|
|
63
|
-
let { showCorrectAnswer: e } = this.state, { prompt: t, mode: n, model: r, rationale: i, teacherInstructions: s, choices: c, displayType: l, language: u } = this.props, { extraCSSRules: d } = r || {}, g = n === "evaluate", _ = !1, v = i && (p(i) || f(i)), y = s && (p(s) || f(s)), S = (Object.keys(c) || []).map((e) => (c[e] || []).reduce((e, t) => (t.rationale && p(t.rationale) && (_ = !0, e.push(t)), e), []));
|
|
64
|
-
return /* @__PURE__ */ h(T, {
|
|
65
|
-
extraCSSRules: d,
|
|
66
|
-
style: { display: `${l}` },
|
|
67
|
-
children: [
|
|
68
|
-
n === "gather" && /* @__PURE__ */ m(A, { children: "Inline Dropdown Question" }),
|
|
69
|
-
y && /* @__PURE__ */ m(E, {
|
|
70
|
-
labels: {
|
|
71
|
-
hidden: "Show Teacher Instructions",
|
|
72
|
-
visible: "Hide Teacher Instructions"
|
|
73
|
-
},
|
|
74
|
-
children: /* @__PURE__ */ m(b, { prompt: s })
|
|
75
|
-
}),
|
|
76
|
-
t && /* @__PURE__ */ m(b, { prompt: t }),
|
|
77
|
-
/* @__PURE__ */ m(a, {
|
|
78
|
-
show: g,
|
|
79
|
-
toggled: e,
|
|
80
|
-
onToggle: this.toggleShowCorrect,
|
|
81
|
-
language: u
|
|
82
|
-
}),
|
|
83
|
-
/* @__PURE__ */ m(o, {
|
|
84
|
-
...this.props,
|
|
85
|
-
showCorrectAnswer: e
|
|
86
|
-
}),
|
|
87
|
-
_ && /* @__PURE__ */ m(E, {
|
|
88
|
-
labels: {
|
|
89
|
-
hidden: "Show Rationale for choices",
|
|
90
|
-
visible: "Hide Rationale for choices"
|
|
91
|
-
},
|
|
92
|
-
children: S.map((e, t) => /* @__PURE__ */ m(D, { children: e?.length > 0 && e.map((e) => /* @__PURE__ */ h(O, { children: [/* @__PURE__ */ m(k, {
|
|
93
|
-
correct: e.correct,
|
|
94
|
-
dangerouslySetInnerHTML: { __html: `${e.label}: ` }
|
|
95
|
-
}), /* @__PURE__ */ m(b, { prompt: e.rationale })] }, e.label)) }, t))
|
|
96
|
-
}),
|
|
97
|
-
v && /* @__PURE__ */ m(x, {
|
|
98
|
-
labels: {
|
|
99
|
-
hidden: "Show Rationale",
|
|
100
|
-
visible: "Hide Rationale"
|
|
101
|
-
},
|
|
102
|
-
children: /* @__PURE__ */ m(b, { prompt: i })
|
|
103
|
-
})
|
|
104
|
-
]
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
//#endregion
|
|
109
|
-
export { j 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