@pie-element/ebsr 7.0.22 → 7.0.24-next.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.md +0 -16
- package/configure/CHANGELOG.md +0 -16
- package/configure/lib/main.js +6 -4
- package/configure/lib/main.js.map +1 -1
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +1972 -0
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +1793 -0
- package/{LICENSE.md → configure/node_modules/@pie-element/multiple-choice/LICENSE.md} +0 -0
- package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +35 -0
- package/configure/node_modules/@pie-element/multiple-choice/README.md +56 -0
- package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +1387 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +1334 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +104 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +198 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +599 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +18 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +20 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +527 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +768 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +18 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +305 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +36 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +15 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +353 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +277 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +52 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +7 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +338 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +274 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +298 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +157 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +174 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +151 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +97 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +254 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +129 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +35 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/configure.js +843 -0
- package/{module → configure/node_modules/@pie-element/multiple-choice/module}/controller.js +17304 -17374
- package/configure/node_modules/@pie-element/multiple-choice/module/demo.js +77 -0
- package/{module → configure/node_modules/@pie-element/multiple-choice/module}/element.js +42 -171
- package/{module → configure/node_modules/@pie-element/multiple-choice/module}/index.html +1 -1
- package/{module → configure/node_modules/@pie-element/multiple-choice/module}/manifest.json +4 -4
- package/{module → configure/node_modules/@pie-element/multiple-choice/module}/print-demo.js +46 -46
- package/{module → configure/node_modules/@pie-element/multiple-choice/module}/print.html +1 -1
- package/{module → configure/node_modules/@pie-element/multiple-choice/module}/print.js +70 -259
- package/configure/node_modules/@pie-element/multiple-choice/package.json +34 -0
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.json +672 -0
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.md +427 -0
- package/configure/node_modules/@pie-lib/math-rendering/LICENSE.md +5 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js +30 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js +316 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js +23 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js +123 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js +103 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js +275 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/package.json +19 -0
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.html +872 -0
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.js +108 -0
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.html +156 -0
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.js +16 -0
- package/configure/node_modules/@pie-lib/math-rendering/playground/webpack.config.js +29 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/index.js +4 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/chtml.js +215 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/index.js +13 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/mml.js +24 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/normalization.js +69 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/render-math.js +234 -0
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.json +937 -0
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.md +602 -0
- package/configure/node_modules/@pie-lib/render-ui/LICENSE.md +5 -0
- package/configure/node_modules/@pie-lib/render-ui/README.md +33 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js +146 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js +134 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js +160 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js +24 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js +102 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js +104 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js +60 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js +133 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js +162 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js +160 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js +206 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/package.json +30 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/index.jsx +68 -0
- package/configure/node_modules/@pie-lib/render-ui/src/color.js +48 -0
- package/configure/node_modules/@pie-lib/render-ui/src/feedback.jsx +100 -0
- package/configure/node_modules/@pie-lib/render-ui/src/has-text.js +14 -0
- package/configure/node_modules/@pie-lib/render-ui/src/html-and-math.js +40 -0
- package/configure/node_modules/@pie-lib/render-ui/src/index.js +27 -0
- package/configure/node_modules/@pie-lib/render-ui/src/input-container.jsx +41 -0
- package/configure/node_modules/@pie-lib/render-ui/src/preview-layout.jsx +77 -0
- package/configure/node_modules/@pie-lib/render-ui/src/preview-prompt.jsx +90 -0
- package/configure/node_modules/@pie-lib/render-ui/src/purpose.jsx +19 -0
- package/configure/node_modules/@pie-lib/render-ui/src/readable.jsx +19 -0
- package/configure/node_modules/@pie-lib/render-ui/src/response-indicators.jsx +89 -0
- package/configure/node_modules/@pie-lib/render-ui/src/withUndoReset.jsx +118 -0
- package/configure/package.json +3 -3
- package/configure/src/__tests__/index.test.js +4 -2
- package/configure/src/main.jsx +8 -3
- package/controller/lib/index.js +79 -3
- package/controller/lib/index.js.map +1 -1
- package/controller/src/index.js +55 -0
- package/package.json +3 -3
- package/module/configure.js +0 -472
- package/module/demo.js +0 -77
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import Configure from './configure.js';
|
|
2
|
+
import Element from './element.js';
|
|
3
|
+
import * as controller from './controller.js';
|
|
4
|
+
|
|
5
|
+
var generate = {};
|
|
6
|
+
|
|
7
|
+
generate.model = (id, element) => ({
|
|
8
|
+
id,
|
|
9
|
+
element,
|
|
10
|
+
choiceMode: 'checkbox',
|
|
11
|
+
choicePrefix: 'numbers',
|
|
12
|
+
choices: [
|
|
13
|
+
{
|
|
14
|
+
correct: true,
|
|
15
|
+
value: 'sweden',
|
|
16
|
+
label: 'Sweden',
|
|
17
|
+
feedback: {
|
|
18
|
+
type: 'none',
|
|
19
|
+
value: ''
|
|
20
|
+
},
|
|
21
|
+
accessibility: 'sweden'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: 'iceland',
|
|
25
|
+
label: 'Iceland',
|
|
26
|
+
feedback: {
|
|
27
|
+
type: 'none',
|
|
28
|
+
value: ''
|
|
29
|
+
},
|
|
30
|
+
rationale: 'Rationale for Iceland',
|
|
31
|
+
accessibility: 'iceland'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: 'norway',
|
|
35
|
+
label: 'Norway',
|
|
36
|
+
feedback: {
|
|
37
|
+
type: 'none',
|
|
38
|
+
value: ''
|
|
39
|
+
},
|
|
40
|
+
rationale: 'Rationale for Norway',
|
|
41
|
+
accessibility: 'norway'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
correct: true,
|
|
45
|
+
value: 'finland',
|
|
46
|
+
label: 'Finland',
|
|
47
|
+
feedback: {
|
|
48
|
+
type: 'none',
|
|
49
|
+
value: ''
|
|
50
|
+
},
|
|
51
|
+
rationale: 'Rationale for Finland',
|
|
52
|
+
accessibility: 'finland'
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
prompt: 'Which of these northern European countries are EU members? <math><mstack><msrow><mn>111</mn></msrow><msline/></mstack></math>',
|
|
56
|
+
promptEnabled: true,
|
|
57
|
+
toolbarEditorPosition: 'bottom'
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const { model } = generate;
|
|
61
|
+
|
|
62
|
+
var config = {
|
|
63
|
+
elements: {
|
|
64
|
+
'multiple-choice': '../..'
|
|
65
|
+
},
|
|
66
|
+
models: [model('1', 'multiple-choice')]
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
//Note: demo-el is a custom element loaded in the markup.
|
|
70
|
+
customElements.whenDefined("demo-el").then(() => {
|
|
71
|
+
config.models.forEach((m) => {
|
|
72
|
+
const de = document.createElement("demo-el");
|
|
73
|
+
document.body.appendChild(de);
|
|
74
|
+
de.def = { tagName: m.element, Element, Configure, controller };
|
|
75
|
+
de.model = m;
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.
|
|
2
|
-
import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.1.
|
|
1
|
+
import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.17/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.1.5/module/index.js";
|
|
3
3
|
function getDefaultExportFromCjs(x) {
|
|
4
4
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
5
|
}
|
|
@@ -19,43 +19,6 @@ function getAugmentedNamespace(n) {
|
|
|
19
19
|
});
|
|
20
20
|
return a;
|
|
21
21
|
}
|
|
22
|
-
var lib = {};
|
|
23
|
-
Object.defineProperty(lib, "__esModule", {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
class ModelSetEvent extends CustomEvent {
|
|
27
|
-
constructor(component, complete, hasModel) {
|
|
28
|
-
super(ModelSetEvent.TYPE, {
|
|
29
|
-
bubbles: true,
|
|
30
|
-
composed: true,
|
|
31
|
-
detail: {
|
|
32
|
-
complete,
|
|
33
|
-
component,
|
|
34
|
-
hasModel
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
this.component = component;
|
|
38
|
-
this.complete = complete;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
ModelSetEvent.TYPE = 'model-set';
|
|
42
|
-
lib.ModelSetEvent = ModelSetEvent;
|
|
43
|
-
class SessionChangedEvent extends CustomEvent {
|
|
44
|
-
constructor(component, complete) {
|
|
45
|
-
super(SessionChangedEvent.TYPE, {
|
|
46
|
-
bubbles: true,
|
|
47
|
-
composed: true,
|
|
48
|
-
detail: {
|
|
49
|
-
complete,
|
|
50
|
-
component
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
this.component = component;
|
|
54
|
-
this.complete = complete;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
SessionChangedEvent.TYPE = 'session-changed';
|
|
58
|
-
var SessionChangedEvent_1 = lib.SessionChangedEvent = SessionChangedEvent;
|
|
59
22
|
var CSSTransition = {
|
|
60
23
|
exports: {}
|
|
61
24
|
};
|
|
@@ -1296,6 +1259,7 @@ const {color: color$1} = _dll_pie_lib__render_ui;
|
|
|
1296
1259
|
const {PreviewPrompt: PreviewPrompt$1} = _dll_pie_lib__render_ui;
|
|
1297
1260
|
const classNames$3 = _dll_classnames;
|
|
1298
1261
|
const _jsxFileName$3 = "/home/circleci/repo/packages/multiple-choice/src/choice-input.jsx";
|
|
1262
|
+
const CLASS_NAME = 'multiple-choice-component';
|
|
1299
1263
|
const styleSheet = () => ({
|
|
1300
1264
|
row: {
|
|
1301
1265
|
display: 'flex',
|
|
@@ -1310,6 +1274,11 @@ const styleSheet = () => ({
|
|
|
1310
1274
|
'& label': {
|
|
1311
1275
|
color: color$1.text()
|
|
1312
1276
|
}
|
|
1277
|
+
},
|
|
1278
|
+
horizontalLayout: {
|
|
1279
|
+
[`& .${CLASS_NAME}`]: {
|
|
1280
|
+
paddingRight: '8px'
|
|
1281
|
+
}
|
|
1313
1282
|
}
|
|
1314
1283
|
});
|
|
1315
1284
|
const formStyleSheet = {
|
|
@@ -1328,10 +1297,9 @@ const StyledFormControlLabel = withStyles$3(formStyleSheet, {
|
|
|
1328
1297
|
__self: undefined,
|
|
1329
1298
|
__source: {
|
|
1330
1299
|
fileName: _jsxFileName$3,
|
|
1331
|
-
lineNumber:
|
|
1300
|
+
lineNumber: 46
|
|
1332
1301
|
}
|
|
1333
1302
|
}));
|
|
1334
|
-
const CLASS_NAME = 'multiple-choice-component';
|
|
1335
1303
|
const colorStyle = (varName, fallback) => ({
|
|
1336
1304
|
[`&.${CLASS_NAME}`]: {
|
|
1337
1305
|
color: `var(--choice-input-${varName}, ${fallback}) !important`
|
|
@@ -1383,7 +1351,7 @@ const StyledCheckbox = withStyles$3(inputStyles)(props => {
|
|
|
1383
1351
|
__self: undefined,
|
|
1384
1352
|
__source: {
|
|
1385
1353
|
fileName: _jsxFileName$3,
|
|
1386
|
-
lineNumber:
|
|
1354
|
+
lineNumber: 97
|
|
1387
1355
|
}
|
|
1388
1356
|
});
|
|
1389
1357
|
});
|
|
@@ -1412,7 +1380,7 @@ const StyledRadio = withStyles$3(inputStyles)(props => {
|
|
|
1412
1380
|
__self: undefined,
|
|
1413
1381
|
__source: {
|
|
1414
1382
|
fileName: _jsxFileName$3,
|
|
1415
|
-
lineNumber:
|
|
1383
|
+
lineNumber: 130
|
|
1416
1384
|
}
|
|
1417
1385
|
});
|
|
1418
1386
|
});
|
|
@@ -1433,7 +1401,8 @@ class ChoiceInput extends React$4.Component {
|
|
|
1433
1401
|
classes: PropTypes$3.object,
|
|
1434
1402
|
className: PropTypes$3.string,
|
|
1435
1403
|
hideTick: PropTypes$3.bool,
|
|
1436
|
-
isEvaluateMode: PropTypes$3.bool
|
|
1404
|
+
isEvaluateMode: PropTypes$3.bool,
|
|
1405
|
+
choicesLayout: PropTypes$3.oneOf(['vertical', 'grid', 'horizontal'])
|
|
1437
1406
|
};
|
|
1438
1407
|
}
|
|
1439
1408
|
static __initStatic2() {
|
|
@@ -1455,36 +1424,39 @@ class ChoiceInput extends React$4.Component {
|
|
|
1455
1424
|
});
|
|
1456
1425
|
}
|
|
1457
1426
|
render() {
|
|
1458
|
-
const {choiceMode, disabled, displayKey, feedback, label, checked, correctness, classes, className, rationale, accessibility, hideTick, isEvaluateMode} = this.props;
|
|
1427
|
+
const {choiceMode, disabled, displayKey, feedback, label, checked, correctness, classes, className, rationale, accessibility, hideTick, isEvaluateMode, choicesLayout} = this.props;
|
|
1459
1428
|
const Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;
|
|
1460
1429
|
const classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';
|
|
1430
|
+
const holderClassNames = classNames$3(classes.checkboxHolder, {
|
|
1431
|
+
[classes.horizontalLayout]: choicesLayout === 'horizontal'
|
|
1432
|
+
});
|
|
1461
1433
|
return React$4.createElement('div', {
|
|
1462
1434
|
className: classNames$3(className, 'corespring-' + classSuffix, 'choice-input'),
|
|
1463
1435
|
__self: this,
|
|
1464
1436
|
__source: {
|
|
1465
1437
|
fileName: _jsxFileName$3,
|
|
1466
|
-
lineNumber:
|
|
1438
|
+
lineNumber: 208
|
|
1467
1439
|
}
|
|
1468
1440
|
}, React$4.createElement('div', {
|
|
1469
1441
|
className: classes.row,
|
|
1470
1442
|
__self: this,
|
|
1471
1443
|
__source: {
|
|
1472
1444
|
fileName: _jsxFileName$3,
|
|
1473
|
-
lineNumber:
|
|
1445
|
+
lineNumber: 209
|
|
1474
1446
|
}
|
|
1475
1447
|
}, !hideTick && isEvaluateMode && React$4.createElement(FeedbackTick$1, {
|
|
1476
1448
|
correctness: correctness,
|
|
1477
1449
|
__self: this,
|
|
1478
1450
|
__source: {
|
|
1479
1451
|
fileName: _jsxFileName$3,
|
|
1480
|
-
lineNumber:
|
|
1452
|
+
lineNumber: 210
|
|
1481
1453
|
}
|
|
1482
1454
|
}), React$4.createElement('div', {
|
|
1483
|
-
className: classNames$3(
|
|
1455
|
+
className: classNames$3(holderClassNames, 'checkbox-holder'),
|
|
1484
1456
|
__self: this,
|
|
1485
1457
|
__source: {
|
|
1486
1458
|
fileName: _jsxFileName$3,
|
|
1487
|
-
lineNumber:
|
|
1459
|
+
lineNumber: 211
|
|
1488
1460
|
}
|
|
1489
1461
|
}, React$4.createElement(StyledFormControlLabel, {
|
|
1490
1462
|
disabled: disabled,
|
|
@@ -1497,13 +1469,13 @@ class ChoiceInput extends React$4.Component {
|
|
|
1497
1469
|
__self: this,
|
|
1498
1470
|
__source: {
|
|
1499
1471
|
fileName: _jsxFileName$3,
|
|
1500
|
-
lineNumber:
|
|
1472
|
+
lineNumber: 216
|
|
1501
1473
|
}
|
|
1502
1474
|
}),
|
|
1503
1475
|
__self: this,
|
|
1504
1476
|
__source: {
|
|
1505
1477
|
fileName: _jsxFileName$3,
|
|
1506
|
-
lineNumber:
|
|
1478
|
+
lineNumber: 212
|
|
1507
1479
|
}
|
|
1508
1480
|
}), React$4.createElement(PreviewPrompt$1, {
|
|
1509
1481
|
className: "label",
|
|
@@ -1513,7 +1485,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
1513
1485
|
__self: this,
|
|
1514
1486
|
__source: {
|
|
1515
1487
|
fileName: _jsxFileName$3,
|
|
1516
|
-
lineNumber:
|
|
1488
|
+
lineNumber: 224
|
|
1517
1489
|
}
|
|
1518
1490
|
}))), rationale && React$4.createElement(PreviewPrompt$1, {
|
|
1519
1491
|
className: "rationale",
|
|
@@ -1522,7 +1494,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
1522
1494
|
__self: this,
|
|
1523
1495
|
__source: {
|
|
1524
1496
|
fileName: _jsxFileName$3,
|
|
1525
|
-
lineNumber:
|
|
1497
|
+
lineNumber: 233
|
|
1526
1498
|
}
|
|
1527
1499
|
}), React$4.createElement(Feedback, {
|
|
1528
1500
|
feedback: feedback,
|
|
@@ -1530,7 +1502,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
1530
1502
|
__self: this,
|
|
1531
1503
|
__source: {
|
|
1532
1504
|
fileName: _jsxFileName$3,
|
|
1533
|
-
lineNumber:
|
|
1505
|
+
lineNumber: 235
|
|
1534
1506
|
}
|
|
1535
1507
|
}));
|
|
1536
1508
|
}
|
|
@@ -1574,7 +1546,8 @@ class Choice extends React$3.Component {
|
|
|
1574
1546
|
isEvaluateMode
|
|
1575
1547
|
};
|
|
1576
1548
|
const names = classNames$2(classes.choice, {
|
|
1577
|
-
[classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical'
|
|
1549
|
+
[classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical',
|
|
1550
|
+
[classes.horizontalLayout]: choicesLayout === 'horizontal'
|
|
1578
1551
|
});
|
|
1579
1552
|
return React$3.createElement('div', {
|
|
1580
1553
|
className: choiceClass,
|
|
@@ -1582,7 +1555,7 @@ class Choice extends React$3.Component {
|
|
|
1582
1555
|
__self: this,
|
|
1583
1556
|
__source: {
|
|
1584
1557
|
fileName: _jsxFileName$2,
|
|
1585
|
-
lineNumber:
|
|
1558
|
+
lineNumber: 57
|
|
1586
1559
|
}
|
|
1587
1560
|
}, React$3.createElement(ChoiceInput$1, {
|
|
1588
1561
|
...choiceProps,
|
|
@@ -1590,7 +1563,7 @@ class Choice extends React$3.Component {
|
|
|
1590
1563
|
__self: this,
|
|
1591
1564
|
__source: {
|
|
1592
1565
|
fileName: _jsxFileName$2,
|
|
1593
|
-
lineNumber:
|
|
1566
|
+
lineNumber: 58
|
|
1594
1567
|
}
|
|
1595
1568
|
}));
|
|
1596
1569
|
}
|
|
@@ -1619,6 +1592,12 @@ var StyledChoice = withStyles$2({
|
|
|
1619
1592
|
},
|
|
1620
1593
|
noBorder: {
|
|
1621
1594
|
borderBottom: 'none'
|
|
1595
|
+
},
|
|
1596
|
+
horizontalLayout: {
|
|
1597
|
+
paddingRight: '20px',
|
|
1598
|
+
'& label': {
|
|
1599
|
+
marginRight: '8px'
|
|
1600
|
+
}
|
|
1622
1601
|
}
|
|
1623
1602
|
})(Choice);
|
|
1624
1603
|
const React$2 = _dll_react;
|
|
@@ -1962,9 +1941,9 @@ function updateSessionValue(session, choiceMode, data) {
|
|
|
1962
1941
|
const React = _dll_react;
|
|
1963
1942
|
const ReactDOM = _dll_react_dom;
|
|
1964
1943
|
const {debounce: debounce} = _dll_lodash;
|
|
1965
|
-
const debug
|
|
1944
|
+
const debug = _dll_debug;
|
|
1966
1945
|
const {renderMath: renderMath} = _dll_pie_lib__math_rendering;
|
|
1967
|
-
const log
|
|
1946
|
+
const log = debug('pie-ui:multiple-choice');
|
|
1968
1947
|
const isComplete = session => !!(session && session.value && session.value.length);
|
|
1969
1948
|
class MultipleChoice extends HTMLElement {
|
|
1970
1949
|
constructor() {
|
|
@@ -1979,11 +1958,11 @@ class MultipleChoice extends HTMLElement {
|
|
|
1979
1958
|
onChoiceChanged: this._onChange.bind(this)
|
|
1980
1959
|
});
|
|
1981
1960
|
ReactDOM.render(element, this, () => {
|
|
1982
|
-
log
|
|
1961
|
+
log('render complete - render math');
|
|
1983
1962
|
renderMath(this);
|
|
1984
1963
|
});
|
|
1985
1964
|
} else {
|
|
1986
|
-
log
|
|
1965
|
+
log('skip');
|
|
1987
1966
|
}
|
|
1988
1967
|
}, 50, {
|
|
1989
1968
|
leading: false,
|
|
@@ -2037,112 +2016,4 @@ class MultipleChoice extends HTMLElement {
|
|
|
2037
2016
|
this._rerender();
|
|
2038
2017
|
}
|
|
2039
2018
|
}
|
|
2040
|
-
|
|
2041
|
-
const debug = _dll_debug;
|
|
2042
|
-
const SESSION_CHANGED = SessionChangedEvent_1.TYPE;
|
|
2043
|
-
const MC_TAG_NAME = 'ebsr-multiple-choice';
|
|
2044
|
-
const log = debug('pie-elements:ebsr');
|
|
2045
|
-
class EbsrMC extends MultipleChoice {}
|
|
2046
|
-
const defineMultipleChoice = () => {
|
|
2047
|
-
if (!customElements.get(MC_TAG_NAME)) {
|
|
2048
|
-
customElements.define(MC_TAG_NAME, EbsrMC);
|
|
2049
|
-
}
|
|
2050
|
-
};
|
|
2051
|
-
defineMultipleChoice();
|
|
2052
|
-
const isNonEmptyArray = a => Array.isArray(a) && a.length > 0;
|
|
2053
|
-
const isSessionComplete = session => {
|
|
2054
|
-
const a = get(session, 'value.partA.value');
|
|
2055
|
-
const b = get(session, 'value.partB.value');
|
|
2056
|
-
return isNonEmptyArray(a) && isNonEmptyArray(b);
|
|
2057
|
-
};
|
|
2058
|
-
class Ebsr extends HTMLElement {
|
|
2059
|
-
constructor() {
|
|
2060
|
-
super();
|
|
2061
|
-
Ebsr.prototype.__init.call(this);
|
|
2062
|
-
this._model = {};
|
|
2063
|
-
this._session = {};
|
|
2064
|
-
}
|
|
2065
|
-
__init() {
|
|
2066
|
-
this.onSessionUpdated = e => {
|
|
2067
|
-
if (e.target === this) {
|
|
2068
|
-
return;
|
|
2069
|
-
}
|
|
2070
|
-
e.preventDefault();
|
|
2071
|
-
e.stopImmediatePropagation();
|
|
2072
|
-
const id = e.target.getAttribute('id');
|
|
2073
|
-
if (id) {
|
|
2074
|
-
const key = `part${id.toUpperCase()}`;
|
|
2075
|
-
if (e.update) {
|
|
2076
|
-
this._model[key] = e.update;
|
|
2077
|
-
}
|
|
2078
|
-
this.dispatchSessionChanged(e.srcElement._session, key);
|
|
2079
|
-
}
|
|
2080
|
-
};
|
|
2081
|
-
}
|
|
2082
|
-
set model(m) {
|
|
2083
|
-
this._model = m;
|
|
2084
|
-
customElements.whenDefined(MC_TAG_NAME).then(() => {
|
|
2085
|
-
this.setPartModel(this.partA, 'partA');
|
|
2086
|
-
this.setPartModel(this.partB, 'partB');
|
|
2087
|
-
});
|
|
2088
|
-
}
|
|
2089
|
-
set session(s) {
|
|
2090
|
-
this._session = s;
|
|
2091
|
-
customElements.whenDefined(MC_TAG_NAME).then(() => {
|
|
2092
|
-
this.setPartSession(this.partA, 'partA');
|
|
2093
|
-
this.setPartSession(this.partB, 'partB');
|
|
2094
|
-
});
|
|
2095
|
-
}
|
|
2096
|
-
get session() {
|
|
2097
|
-
return this._session;
|
|
2098
|
-
}
|
|
2099
|
-
setPartModel(part, key) {
|
|
2100
|
-
if (this._model && this._model[key]) {
|
|
2101
|
-
const {mode} = this._model;
|
|
2102
|
-
part.model = {
|
|
2103
|
-
...this._model[key],
|
|
2104
|
-
mode,
|
|
2105
|
-
keyMode: this._model[key].choicePrefix
|
|
2106
|
-
};
|
|
2107
|
-
}
|
|
2108
|
-
}
|
|
2109
|
-
setPartSession(part, key) {
|
|
2110
|
-
if (this._session && this._model) {
|
|
2111
|
-
const {value} = this._session;
|
|
2112
|
-
part.session = value && value[key] ? value[key] : {
|
|
2113
|
-
id: key
|
|
2114
|
-
};
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
dispatchSessionChanged(partSession, key) {
|
|
2118
|
-
this._session.value = {
|
|
2119
|
-
...this._session.value,
|
|
2120
|
-
[key]: partSession
|
|
2121
|
-
};
|
|
2122
|
-
log('[onSessionChanged] session: ', this._session);
|
|
2123
|
-
const complete = isSessionComplete(this._session);
|
|
2124
|
-
this.dispatchEvent(new SessionChangedEvent_1(this.tagName.toLowerCase(), complete));
|
|
2125
|
-
}
|
|
2126
|
-
get partA() {
|
|
2127
|
-
return this.querySelector(`${MC_TAG_NAME}#a`);
|
|
2128
|
-
}
|
|
2129
|
-
get partB() {
|
|
2130
|
-
return this.querySelector(`${MC_TAG_NAME}#b`);
|
|
2131
|
-
}
|
|
2132
|
-
connectedCallback() {
|
|
2133
|
-
this._render();
|
|
2134
|
-
this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);
|
|
2135
|
-
}
|
|
2136
|
-
disconnectedCallback() {
|
|
2137
|
-
this.removeEventListener(SESSION_CHANGED, this.onSessionUpdated);
|
|
2138
|
-
}
|
|
2139
|
-
_render() {
|
|
2140
|
-
this.innerHTML = `
|
|
2141
|
-
<div>
|
|
2142
|
-
<${MC_TAG_NAME} id="a"></${MC_TAG_NAME}>
|
|
2143
|
-
<${MC_TAG_NAME} id="b"></${MC_TAG_NAME}>
|
|
2144
|
-
</div>
|
|
2145
|
-
`;
|
|
2146
|
-
}
|
|
2147
|
-
}
|
|
2148
|
-
export {Ebsr as default, isSessionComplete};
|
|
2019
|
+
export {MultipleChoice as default, isComplete};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@pie-element/
|
|
3
|
-
"version": "
|
|
2
|
+
"name": "@pie-element/multiple-choice",
|
|
3
|
+
"version": "6.3.1",
|
|
4
4
|
"modules": [
|
|
5
5
|
{
|
|
6
6
|
"name": "@pie-lib/shared-module",
|
|
7
|
-
"version": "^1.4.
|
|
7
|
+
"version": "^1.4.17"
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"name": "@pie-lib/math-rendering-module",
|
|
11
|
-
"version": "^1.1.
|
|
11
|
+
"version": "^1.1.5"
|
|
12
12
|
}
|
|
13
13
|
]
|
|
14
14
|
}
|
|
@@ -5,63 +5,63 @@ var generate = {};
|
|
|
5
5
|
generate.model = (id, element) => ({
|
|
6
6
|
id,
|
|
7
7
|
element,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
choiceMode: 'checkbox',
|
|
9
|
+
choicePrefix: 'numbers',
|
|
10
|
+
choices: [
|
|
11
|
+
{
|
|
12
|
+
correct: true,
|
|
13
|
+
value: 'sweden',
|
|
14
|
+
label: 'Sweden',
|
|
15
|
+
feedback: {
|
|
16
|
+
type: 'none',
|
|
17
|
+
value: ''
|
|
14
18
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
accessibility: 'sweden'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: 'iceland',
|
|
23
|
+
label: 'Iceland',
|
|
24
|
+
feedback: {
|
|
25
|
+
type: 'none',
|
|
26
|
+
value: ''
|
|
18
27
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
rationale: 'Rationale for Iceland',
|
|
29
|
+
accessibility: 'iceland'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: 'norway',
|
|
33
|
+
label: 'Norway',
|
|
34
|
+
feedback: {
|
|
35
|
+
type: 'none',
|
|
36
|
+
value: ''
|
|
23
37
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
value: 'orange',
|
|
35
|
-
label: 'Orange',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
correct: true,
|
|
39
|
-
value: 'purple',
|
|
40
|
-
label: 'Purple',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
value: 'pink',
|
|
44
|
-
label: 'Pink',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
value: 'green',
|
|
48
|
-
label: 'Green',
|
|
38
|
+
rationale: 'Rationale for Norway',
|
|
39
|
+
accessibility: 'norway'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
correct: true,
|
|
43
|
+
value: 'finland',
|
|
44
|
+
label: 'Finland',
|
|
45
|
+
feedback: {
|
|
46
|
+
type: 'none',
|
|
47
|
+
value: ''
|
|
49
48
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
rationale: 'Rationale for Finland',
|
|
50
|
+
accessibility: 'finland'
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
prompt: 'Which of these northern European countries are EU members? <math><mstack><msrow><mn>111</mn></msrow><msline/></mstack></math>',
|
|
54
|
+
promptEnabled: true,
|
|
55
|
+
toolbarEditorPosition: 'bottom'
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
const { model } = generate;
|
|
59
59
|
|
|
60
60
|
var config = {
|
|
61
61
|
elements: {
|
|
62
|
-
'
|
|
62
|
+
'multiple-choice': '../..'
|
|
63
63
|
},
|
|
64
|
-
models: [model('1', '
|
|
64
|
+
models: [model('1', 'multiple-choice')]
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
// new init - just shows off print!
|