@pie-element/drawing-response 3.6.0 → 3.6.1-beta.587
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 +507 -0
- package/configure/CHANGELOG.md +446 -0
- package/configure/lib/button.js.map +1 -1
- package/configure/lib/defaults.js +22 -7
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/image-container.js +44 -24
- package/configure/lib/image-container.js.map +1 -1
- package/configure/lib/index.js +65 -12
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/root.js +78 -48
- package/configure/lib/root.js.map +1 -1
- package/configure/package.json +4 -4
- package/configure/src/__tests__/__snapshots__/image-container.test.jsx.snap +3 -2
- package/configure/src/__tests__/__snapshots__/root.test.jsx.snap +38 -18
- package/configure/src/__tests__/image-container.test.jsx +42 -35
- package/configure/src/__tests__/index.test.js +7 -7
- package/configure/src/__tests__/root.test.jsx +18 -25
- package/configure/src/button.jsx +4 -4
- package/configure/src/defaults.js +25 -10
- package/configure/src/image-container.jsx +80 -59
- package/configure/src/index.js +46 -14
- package/configure/src/root.jsx +72 -76
- package/controller/CHANGELOG.md +58 -0
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +13 -12
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/controller/src/__tests__/index.test.js +35 -34
- package/controller/src/defaults.js +2 -2
- package/controller/src/index.js +13 -17
- package/docs/config-schema.json +111 -1
- package/docs/config-schema.json.md +87 -3
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +5 -2
- package/docs/demo/session.js +4 -4
- package/docs/pie-schema.json +70 -6
- package/docs/pie-schema.json.md +55 -4
- package/lib/drawing-response/button.js.map +1 -1
- package/lib/drawing-response/constants.js.map +1 -1
- package/lib/drawing-response/container.js +80 -25
- package/lib/drawing-response/container.js.map +1 -1
- package/lib/drawing-response/drawable-circle.js +1 -1
- package/lib/drawing-response/drawable-circle.js.map +1 -1
- package/lib/drawing-response/drawable-eraser.js +1 -1
- package/lib/drawing-response/drawable-eraser.js.map +1 -1
- package/lib/drawing-response/drawable-free-path.js +1 -1
- package/lib/drawing-response/drawable-free-path.js.map +1 -1
- package/lib/drawing-response/drawable-helper.js.map +1 -1
- package/lib/drawing-response/drawable-image.js +1 -0
- package/lib/drawing-response/drawable-image.js.map +1 -1
- package/lib/drawing-response/drawable-line.js +1 -1
- package/lib/drawing-response/drawable-line.js.map +1 -1
- package/lib/drawing-response/drawable-main.js +46 -16
- package/lib/drawing-response/drawable-main.js.map +1 -1
- package/lib/drawing-response/drawable-palette.js +7 -2
- package/lib/drawing-response/drawable-palette.js.map +1 -1
- package/lib/drawing-response/drawable-rectangle.js +1 -1
- package/lib/drawing-response/drawable-rectangle.js.map +1 -1
- package/lib/drawing-response/drawable-text.js +15 -5
- package/lib/drawing-response/drawable-text.js.map +1 -1
- package/lib/drawing-response/drawable-transformer.js +1 -1
- package/lib/drawing-response/drawable-transformer.js.map +1 -1
- package/lib/drawing-response/factory.js.map +1 -1
- package/lib/drawing-response/icon.js.map +1 -1
- package/lib/drawing-response/index.js +11 -15
- package/lib/drawing-response/index.js.map +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/package.json +5 -4
- package/src/__tests__/drawing-index-test.jsx +4 -4
- package/src/drawing-response/__tests__/__snapshots__/container.test.jsx.snap +174 -290
- package/src/drawing-response/__tests__/__snapshots__/drawing-main.test.jsx.snap +26 -2
- package/src/drawing-response/__tests__/container.test.jsx +9 -2
- package/src/drawing-response/__tests__/drawable-helper.test.jsx +1 -1
- package/src/drawing-response/__tests__/drawing-main.test.jsx +74 -86
- package/src/drawing-response/button.jsx +5 -8
- package/src/drawing-response/constants.js +42 -34
- package/src/drawing-response/container.jsx +93 -70
- package/src/drawing-response/drawable-image.jsx +5 -4
- package/src/drawing-response/drawable-main.jsx +46 -17
- package/src/drawing-response/drawable-palette.jsx +18 -35
- package/src/drawing-response/drawable-text.jsx +34 -48
- package/src/drawing-response/drawable-transformer.jsx +3 -1
- package/src/drawing-response/factory.js +3 -11
- package/src/drawing-response/icon.jsx +19 -20
- package/src/drawing-response/index.jsx +14 -20
- package/src/index.js +8 -11
package/controller/lib/index.js
CHANGED
|
@@ -5,9 +5,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.createDefaultModel = void 0;
|
|
8
9
|
exports.model = model;
|
|
10
|
+
exports.normalize = void 0;
|
|
9
11
|
exports.outcome = outcome;
|
|
10
|
-
exports.createDefaultModel = exports.normalize = void 0;
|
|
11
12
|
|
|
12
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
14
|
|
|
@@ -15,18 +16,18 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
15
16
|
|
|
16
17
|
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
17
18
|
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
20
|
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
22
|
|
|
22
23
|
var log = (0, _debug["default"])('pie-elements:drawing-response:controller');
|
|
23
24
|
|
|
24
25
|
var normalize = function normalize(question) {
|
|
25
26
|
return _objectSpread({
|
|
26
|
-
rationaleEnabled: true,
|
|
27
27
|
promptEnabled: true,
|
|
28
28
|
teacherInstructionsEnabled: true,
|
|
29
|
-
studentInstructionsEnabled: true
|
|
29
|
+
studentInstructionsEnabled: true,
|
|
30
|
+
backgroundImageEnabled: true
|
|
30
31
|
}, question);
|
|
31
32
|
};
|
|
32
33
|
|
|
@@ -37,22 +38,22 @@ function model(question, session, env) {
|
|
|
37
38
|
var imageUrl = normalizedQuestion.imageUrl,
|
|
38
39
|
imageDimensions = normalizedQuestion.imageDimensions,
|
|
39
40
|
prompt = normalizedQuestion.prompt,
|
|
40
|
-
promptEnabled = normalizedQuestion.promptEnabled
|
|
41
|
+
promptEnabled = normalizedQuestion.promptEnabled,
|
|
42
|
+
backgroundImageEnabled = normalizedQuestion.backgroundImageEnabled;
|
|
41
43
|
return new Promise(function (resolve) {
|
|
42
44
|
var out = {
|
|
43
45
|
disabled: env.mode !== 'gather',
|
|
44
46
|
mode: env.mode,
|
|
45
47
|
imageDimensions: imageDimensions,
|
|
46
48
|
imageUrl: imageUrl,
|
|
47
|
-
prompt: promptEnabled ? prompt : null
|
|
49
|
+
prompt: promptEnabled ? prompt : null,
|
|
50
|
+
backgroundImageEnabled: backgroundImageEnabled
|
|
48
51
|
};
|
|
49
52
|
|
|
50
53
|
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
51
54
|
out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
|
|
52
|
-
out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;
|
|
53
55
|
} else {
|
|
54
56
|
out.teacherInstructions = null;
|
|
55
|
-
out.rationale = null;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
resolve(out);
|
|
@@ -68,9 +69,9 @@ var createDefaultModel = function createDefaultModel() {
|
|
|
68
69
|
|
|
69
70
|
exports.createDefaultModel = createDefaultModel;
|
|
70
71
|
|
|
71
|
-
function
|
|
72
|
-
/*config, session*/
|
|
73
|
-
{
|
|
72
|
+
function
|
|
73
|
+
/*config, session*/
|
|
74
|
+
outcome() {
|
|
74
75
|
return new Promise(function (resolve) {
|
|
75
76
|
log('outcome...');
|
|
76
77
|
resolve({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","normalize","question","
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","normalize","question","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","backgroundImageEnabled","model","session","env","normalizedQuestion","imageUrl","imageDimensions","prompt","Promise","resolve","out","disabled","mode","role","teacherInstructions","createDefaultModel","defaults","outcome","score","completed","note"],"mappings":";;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0CAAN,CAAZ;;AAEO,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,QAAD;AAAA;AACvBC,IAAAA,aAAa,EAAE,IADQ;AAEvBC,IAAAA,0BAA0B,EAAE,IAFL;AAGvBC,IAAAA,0BAA0B,EAAE,IAHL;AAIvBC,IAAAA,sBAAsB,EAAE;AAJD,KAKpBJ,QALoB;AAAA,CAAlB;;;;AAQA,SAASK,KAAT,CAAeL,QAAf,EAAyBM,OAAzB,EAAkCC,GAAlC,EAAuC;AAC5C,MAAMC,kBAAkB,GAAGT,SAAS,CAACC,QAAD,CAApC;AACA,MAAQS,QAAR,GAAqFD,kBAArF,CAAQC,QAAR;AAAA,MAAkBC,eAAlB,GAAqFF,kBAArF,CAAkBE,eAAlB;AAAA,MAAmCC,MAAnC,GAAqFH,kBAArF,CAAmCG,MAAnC;AAAA,MAA2CV,aAA3C,GAAqFO,kBAArF,CAA2CP,aAA3C;AAAA,MAA0DG,sBAA1D,GAAqFI,kBAArF,CAA0DJ,sBAA1D;AAEA,SAAO,IAAIQ,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9B,QAAMC,GAAG,GAAG;AACVC,MAAAA,QAAQ,EAAER,GAAG,CAACS,IAAJ,KAAa,QADb;AAEVA,MAAAA,IAAI,EAAET,GAAG,CAACS,IAFA;AAGVN,MAAAA,eAAe,EAAfA,eAHU;AAIVD,MAAAA,QAAQ,EAARA,QAJU;AAKVE,MAAAA,MAAM,EAAEV,aAAa,GAAGU,MAAH,GAAY,IALvB;AAMVP,MAAAA,sBAAsB,EAAtBA;AANU,KAAZ;;AASA,QAAIG,GAAG,CAACU,IAAJ,KAAa,YAAb,KAA8BV,GAAG,CAACS,IAAJ,KAAa,MAAb,IAAuBT,GAAG,CAACS,IAAJ,KAAa,UAAlE,CAAJ,EAAmF;AACjFF,MAAAA,GAAG,CAACI,mBAAJ,GAA0BV,kBAAkB,CAACN,0BAAnB,GACtBM,kBAAkB,CAACU,mBADG,GAEtB,IAFJ;AAGD,KAJD,MAIO;AACLJ,MAAAA,GAAG,CAACI,mBAAJ,GAA0B,IAA1B;AACD;;AAEDL,IAAAA,OAAO,CAACC,GAAD,CAAP;AACD,GAnBM,CAAP;AAoBD;;AAEM,IAAMK,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,MAACd,KAAD,uEAAS,EAAT;AAAA,SAChC,IAAIO,OAAJ,CAAY,UAACC,OAAD,EAAa;AACvBA,IAAAA,OAAO,iCACFO,oBADE,GAEFf,KAFE,EAAP;AAID,GALD,CADgC;AAAA,CAA3B;;;;AAQA;AAAiB;AAARgB,OAAT,GAAsC;AAC3C,SAAO,IAAIT,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9Bf,IAAAA,GAAG,CAAC,YAAD,CAAH;AACAe,IAAAA,OAAO,CAAC;AACNS,MAAAA,KAAK,EAAE,CADD;AAENC,MAAAA,SAAS,EAAE,KAFL;AAGNC,MAAAA,IAAI,EAAE;AAHA,KAAD,CAAP;AAKD,GAPM,CAAP;AAQD","sourcesContent":["import debug from 'debug';\nimport defaults from './defaults';\n\nconst log = debug('pie-elements:drawing-response:controller');\n\nexport const normalize = (question) => ({\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n backgroundImageEnabled: true,\n ...question,\n});\n\nexport function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const { imageUrl, imageDimensions, prompt, promptEnabled, backgroundImageEnabled } = normalizedQuestion;\n\n return new Promise((resolve) => {\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n imageDimensions,\n imageUrl,\n prompt: promptEnabled ? prompt : null,\n backgroundImageEnabled,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n}\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nexport function outcome(/*config, session*/) {\n return new Promise((resolve) => {\n log('outcome...');\n resolve({\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring',\n });\n });\n}\n"],"file":"index.js"}
|
package/controller/package.json
CHANGED
|
@@ -10,10 +10,10 @@ describe('controller', () => {
|
|
|
10
10
|
imageUrl: '',
|
|
11
11
|
imageDimensions: {
|
|
12
12
|
height: 0,
|
|
13
|
-
width: 0
|
|
13
|
+
width: 0,
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
teacherInstructions: 'Teacher Instructions',
|
|
16
|
+
backgroundImageEnabled: true,
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -49,7 +49,7 @@ describe('controller', () => {
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
it('gather mode promptEnabled: true', async () => {
|
|
52
|
-
result = await model(question, {}, { mode: 'gather'});
|
|
52
|
+
result = await model(question, {}, { mode: 'gather' });
|
|
53
53
|
|
|
54
54
|
expect(result).toEqual({
|
|
55
55
|
disabled: false,
|
|
@@ -57,13 +57,13 @@ describe('controller', () => {
|
|
|
57
57
|
imageUrl: question.imageUrl,
|
|
58
58
|
imageDimensions: question.imageDimensions,
|
|
59
59
|
prompt: question.prompt,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
teacherInstructions: null,
|
|
61
|
+
backgroundImageEnabled: question.backgroundImageEnabled,
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('gather mode promptEnabled: false', async () => {
|
|
66
|
-
result = await model({ ...question, promptEnabled: false }, {}, { mode: 'gather'});
|
|
66
|
+
result = await model({ ...question, promptEnabled: false }, {}, { mode: 'gather' });
|
|
67
67
|
|
|
68
68
|
expect(result).toEqual({
|
|
69
69
|
disabled: false,
|
|
@@ -71,14 +71,13 @@ describe('controller', () => {
|
|
|
71
71
|
imageUrl: question.imageUrl,
|
|
72
72
|
imageDimensions: question.imageDimensions,
|
|
73
73
|
prompt: null,
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
teacherInstructions: null,
|
|
75
|
+
backgroundImageEnabled: question.backgroundImageEnabled,
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
|
|
80
79
|
it('view mode, student role', async () => {
|
|
81
|
-
result = await model(question, {}, { mode: 'view'});
|
|
80
|
+
result = await model(question, {}, { mode: 'view' });
|
|
82
81
|
|
|
83
82
|
expect(result).toEqual({
|
|
84
83
|
disabled: true,
|
|
@@ -86,13 +85,13 @@ describe('controller', () => {
|
|
|
86
85
|
imageUrl: question.imageUrl,
|
|
87
86
|
imageDimensions: question.imageDimensions,
|
|
88
87
|
prompt: question.prompt,
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
teacherInstructions: null,
|
|
89
|
+
backgroundImageEnabled: question.backgroundImageEnabled,
|
|
91
90
|
});
|
|
92
91
|
});
|
|
93
92
|
|
|
94
|
-
it('view mode, instructor role
|
|
95
|
-
result = await model(question, {}, { mode: 'view', role: 'instructor'});
|
|
93
|
+
it('view mode, instructor role and teacherInstructions enabled', async () => {
|
|
94
|
+
result = await model(question, {}, { mode: 'view', role: 'instructor' });
|
|
96
95
|
|
|
97
96
|
expect(result).toEqual({
|
|
98
97
|
disabled: true,
|
|
@@ -100,16 +99,17 @@ describe('controller', () => {
|
|
|
100
99
|
imageUrl: question.imageUrl,
|
|
101
100
|
imageDimensions: question.imageDimensions,
|
|
102
101
|
prompt: question.prompt,
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
teacherInstructions: question.teacherInstructions,
|
|
103
|
+
backgroundImageEnabled: question.backgroundImageEnabled,
|
|
105
104
|
});
|
|
106
105
|
});
|
|
107
106
|
|
|
108
|
-
it('evaluate mode, instructor role
|
|
107
|
+
it('evaluate mode, instructor role and teacherInstructions disabled', async () => {
|
|
109
108
|
result = await model(
|
|
110
|
-
{ ...question,
|
|
109
|
+
{ ...question, teacherInstructionsEnabled: false },
|
|
111
110
|
{},
|
|
112
|
-
{ mode: 'evaluate', role: 'instructor'}
|
|
111
|
+
{ mode: 'evaluate', role: 'instructor' },
|
|
112
|
+
);
|
|
113
113
|
|
|
114
114
|
expect(result).toEqual({
|
|
115
115
|
disabled: true,
|
|
@@ -117,13 +117,13 @@ describe('controller', () => {
|
|
|
117
117
|
imageUrl: question.imageUrl,
|
|
118
118
|
imageDimensions: question.imageDimensions,
|
|
119
119
|
prompt: question.prompt,
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
teacherInstructions: null,
|
|
121
|
+
backgroundImageEnabled: question.backgroundImageEnabled,
|
|
122
122
|
});
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
it('evaluate mode, student role', async () => {
|
|
126
|
-
result = await model(question, {}, { mode: 'evaluate'});
|
|
126
|
+
result = await model(question, {}, { mode: 'evaluate' });
|
|
127
127
|
|
|
128
128
|
expect(result).toEqual({
|
|
129
129
|
disabled: true,
|
|
@@ -131,13 +131,13 @@ describe('controller', () => {
|
|
|
131
131
|
imageUrl: question.imageUrl,
|
|
132
132
|
imageDimensions: question.imageDimensions,
|
|
133
133
|
prompt: question.prompt,
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
teacherInstructions: null,
|
|
135
|
+
backgroundImageEnabled: question.backgroundImageEnabled,
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
it('evaluate mode, instructor role
|
|
140
|
-
result = await model(question, {}, { mode: 'evaluate', role: 'instructor'});
|
|
139
|
+
it('evaluate mode, instructor role and teacherInstructions enabled', async () => {
|
|
140
|
+
result = await model(question, {}, { mode: 'evaluate', role: 'instructor' });
|
|
141
141
|
|
|
142
142
|
expect(result).toEqual({
|
|
143
143
|
disabled: true,
|
|
@@ -145,16 +145,17 @@ describe('controller', () => {
|
|
|
145
145
|
imageUrl: question.imageUrl,
|
|
146
146
|
imageDimensions: question.imageDimensions,
|
|
147
147
|
prompt: question.prompt,
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
teacherInstructions: question.teacherInstructions,
|
|
149
|
+
backgroundImageEnabled: question.backgroundImageEnabled,
|
|
150
150
|
});
|
|
151
151
|
});
|
|
152
152
|
|
|
153
|
-
it('view mode, instructor role
|
|
153
|
+
it('view mode, instructor role and teacherInstructions disabled', async () => {
|
|
154
154
|
result = await model(
|
|
155
|
-
{ ...question,
|
|
155
|
+
{ ...question, teacherInstructionsEnabled: false },
|
|
156
156
|
{},
|
|
157
|
-
{ mode: 'view', role: 'instructor'}
|
|
157
|
+
{ mode: 'view', role: 'instructor' },
|
|
158
|
+
);
|
|
158
159
|
|
|
159
160
|
expect(result).toEqual({
|
|
160
161
|
disabled: true,
|
|
@@ -162,8 +163,8 @@ describe('controller', () => {
|
|
|
162
163
|
imageUrl: question.imageUrl,
|
|
163
164
|
imageDimensions: question.imageDimensions,
|
|
164
165
|
prompt: question.prompt,
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
teacherInstructions: null,
|
|
167
|
+
backgroundImageEnabled: question.backgroundImageEnabled,
|
|
167
168
|
});
|
|
168
169
|
});
|
|
169
170
|
});
|
package/controller/src/index.js
CHANGED
|
@@ -3,38 +3,34 @@ import defaults from './defaults';
|
|
|
3
3
|
|
|
4
4
|
const log = debug('pie-elements:drawing-response:controller');
|
|
5
5
|
|
|
6
|
-
export const normalize = question => ({
|
|
7
|
-
rationaleEnabled: true,
|
|
6
|
+
export const normalize = (question) => ({
|
|
8
7
|
promptEnabled: true,
|
|
9
8
|
teacherInstructionsEnabled: true,
|
|
10
9
|
studentInstructionsEnabled: true,
|
|
10
|
+
backgroundImageEnabled: true,
|
|
11
11
|
...question,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
export function model(question, session, env) {
|
|
15
15
|
const normalizedQuestion = normalize(question);
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
prompt,
|
|
20
|
-
promptEnabled
|
|
21
|
-
} = normalizedQuestion;
|
|
22
|
-
|
|
23
|
-
return new Promise(resolve => {
|
|
16
|
+
const { imageUrl, imageDimensions, prompt, promptEnabled, backgroundImageEnabled } = normalizedQuestion;
|
|
17
|
+
|
|
18
|
+
return new Promise((resolve) => {
|
|
24
19
|
const out = {
|
|
25
20
|
disabled: env.mode !== 'gather',
|
|
26
21
|
mode: env.mode,
|
|
27
22
|
imageDimensions,
|
|
28
23
|
imageUrl,
|
|
29
24
|
prompt: promptEnabled ? prompt : null,
|
|
25
|
+
backgroundImageEnabled,
|
|
30
26
|
};
|
|
31
27
|
|
|
32
28
|
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
33
|
-
out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled
|
|
34
|
-
|
|
29
|
+
out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled
|
|
30
|
+
? normalizedQuestion.teacherInstructions
|
|
31
|
+
: null;
|
|
35
32
|
} else {
|
|
36
33
|
out.teacherInstructions = null;
|
|
37
|
-
out.rationale = null;
|
|
38
34
|
}
|
|
39
35
|
|
|
40
36
|
resolve(out);
|
|
@@ -42,20 +38,20 @@ export function model(question, session, env) {
|
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
export const createDefaultModel = (model = {}) =>
|
|
45
|
-
new Promise(resolve => {
|
|
41
|
+
new Promise((resolve) => {
|
|
46
42
|
resolve({
|
|
47
43
|
...defaults,
|
|
48
44
|
...model,
|
|
49
|
-
})
|
|
45
|
+
});
|
|
50
46
|
});
|
|
51
47
|
|
|
52
48
|
export function outcome(/*config, session*/) {
|
|
53
|
-
return new Promise(resolve => {
|
|
49
|
+
return new Promise((resolve) => {
|
|
54
50
|
log('outcome...');
|
|
55
51
|
resolve({
|
|
56
52
|
score: 0,
|
|
57
53
|
completed: 'n/a',
|
|
58
|
-
note: 'Requires manual scoring'
|
|
54
|
+
note: 'Requires manual scoring',
|
|
59
55
|
});
|
|
60
56
|
});
|
|
61
57
|
}
|
package/docs/config-schema.json
CHANGED
|
@@ -40,7 +40,12 @@
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
"
|
|
43
|
+
"settingsPanelDisabled": {
|
|
44
|
+
"description": "Indicates if the settings panel is not available",
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"title": "settingsPanelDisabled"
|
|
47
|
+
},
|
|
48
|
+
"spellCheck": {
|
|
44
49
|
"title": "ConfigureProp",
|
|
45
50
|
"type": "object",
|
|
46
51
|
"properties": {
|
|
@@ -88,6 +93,69 @@
|
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
},
|
|
96
|
+
"maxImageWidth": {
|
|
97
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
98
|
+
"type": "object",
|
|
99
|
+
"properties": {
|
|
100
|
+
"teacherInstructions": {
|
|
101
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
102
|
+
"type": "number",
|
|
103
|
+
"title": "teacherInstructions"
|
|
104
|
+
},
|
|
105
|
+
"prompt": {
|
|
106
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
107
|
+
"type": "number",
|
|
108
|
+
"title": "prompt"
|
|
109
|
+
},
|
|
110
|
+
"rationale": {
|
|
111
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
112
|
+
"type": "number",
|
|
113
|
+
"title": "rationale"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"maxImageHeight": {
|
|
118
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
119
|
+
"type": "object",
|
|
120
|
+
"properties": {
|
|
121
|
+
"teacherInstructions": {
|
|
122
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
123
|
+
"type": "number",
|
|
124
|
+
"title": "teacherInstructions"
|
|
125
|
+
},
|
|
126
|
+
"prompt": {
|
|
127
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
128
|
+
"type": "number",
|
|
129
|
+
"title": "prompt"
|
|
130
|
+
},
|
|
131
|
+
"rationale": {
|
|
132
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
133
|
+
"type": "number",
|
|
134
|
+
"title": "rationale"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"withRubric": {
|
|
139
|
+
"title": "ConfigureWithForceProp",
|
|
140
|
+
"type": "object",
|
|
141
|
+
"properties": {
|
|
142
|
+
"settings": {
|
|
143
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
144
|
+
"type": "boolean",
|
|
145
|
+
"title": "settings"
|
|
146
|
+
},
|
|
147
|
+
"label": {
|
|
148
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
149
|
+
"type": "string",
|
|
150
|
+
"title": "label"
|
|
151
|
+
},
|
|
152
|
+
"forceEnabled": {
|
|
153
|
+
"description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
|
|
154
|
+
"type": "boolean",
|
|
155
|
+
"title": "forceEnabled"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
91
159
|
"showPrompt": {
|
|
92
160
|
"description": "Determines whether prompt field will be displayed or not",
|
|
93
161
|
"default": true,
|
|
@@ -138,6 +206,48 @@
|
|
|
138
206
|
"title": "label"
|
|
139
207
|
}
|
|
140
208
|
}
|
|
209
|
+
},
|
|
210
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
211
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
212
|
+
"type": "object",
|
|
213
|
+
"properties": {
|
|
214
|
+
"teacherInstructions": {
|
|
215
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
216
|
+
"type": "number",
|
|
217
|
+
"title": "teacherInstructions"
|
|
218
|
+
},
|
|
219
|
+
"prompt": {
|
|
220
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
221
|
+
"type": "number",
|
|
222
|
+
"title": "prompt"
|
|
223
|
+
},
|
|
224
|
+
"rationale": {
|
|
225
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
226
|
+
"type": "number",
|
|
227
|
+
"title": "rationale"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"ConfigureWithForceProp": {
|
|
232
|
+
"title": "ConfigureWithForceProp",
|
|
233
|
+
"type": "object",
|
|
234
|
+
"properties": {
|
|
235
|
+
"settings": {
|
|
236
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
237
|
+
"type": "boolean",
|
|
238
|
+
"title": "settings"
|
|
239
|
+
},
|
|
240
|
+
"label": {
|
|
241
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
242
|
+
"type": "string",
|
|
243
|
+
"title": "label"
|
|
244
|
+
},
|
|
245
|
+
"forceEnabled": {
|
|
246
|
+
"description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
|
|
247
|
+
"type": "boolean",
|
|
248
|
+
"title": "forceEnabled"
|
|
249
|
+
}
|
|
250
|
+
}
|
|
141
251
|
}
|
|
142
252
|
},
|
|
143
253
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
@@ -31,9 +31,13 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
31
31
|
|
|
32
32
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
33
33
|
|
|
34
|
-
# `
|
|
34
|
+
# `settingsPanelDisabled` (boolean)
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Indicates if the settings panel is not available
|
|
37
|
+
|
|
38
|
+
# `spellCheck` (object)
|
|
39
|
+
|
|
40
|
+
Properties of the `spellCheck` object:
|
|
37
41
|
|
|
38
42
|
## `settings` (boolean)
|
|
39
43
|
|
|
@@ -67,6 +71,54 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
67
71
|
|
|
68
72
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
69
73
|
|
|
74
|
+
# `maxImageWidth` (object)
|
|
75
|
+
|
|
76
|
+
Properties of the `maxImageWidth` object:
|
|
77
|
+
|
|
78
|
+
## `teacherInstructions` (number)
|
|
79
|
+
|
|
80
|
+
Indicates the max dimension for images in teacher instructions
|
|
81
|
+
|
|
82
|
+
## `prompt` (number)
|
|
83
|
+
|
|
84
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
85
|
+
|
|
86
|
+
## `rationale` (number)
|
|
87
|
+
|
|
88
|
+
Indicates the max dimension for images in rationale
|
|
89
|
+
|
|
90
|
+
# `maxImageHeight` (object)
|
|
91
|
+
|
|
92
|
+
Properties of the `maxImageHeight` object:
|
|
93
|
+
|
|
94
|
+
## `teacherInstructions` (number)
|
|
95
|
+
|
|
96
|
+
Indicates the max dimension for images in teacher instructions
|
|
97
|
+
|
|
98
|
+
## `prompt` (number)
|
|
99
|
+
|
|
100
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
101
|
+
|
|
102
|
+
## `rationale` (number)
|
|
103
|
+
|
|
104
|
+
Indicates the max dimension for images in rationale
|
|
105
|
+
|
|
106
|
+
# `withRubric` (object)
|
|
107
|
+
|
|
108
|
+
Properties of the `withRubric` object:
|
|
109
|
+
|
|
110
|
+
## `settings` (boolean)
|
|
111
|
+
|
|
112
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
113
|
+
|
|
114
|
+
## `label` (string)
|
|
115
|
+
|
|
116
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
117
|
+
|
|
118
|
+
## `forceEnabled` (boolean)
|
|
119
|
+
|
|
120
|
+
Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
|
|
121
|
+
|
|
70
122
|
# `showPrompt` (boolean)
|
|
71
123
|
|
|
72
124
|
Determines whether prompt field will be displayed or not
|
|
@@ -112,4 +164,36 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
112
164
|
|
|
113
165
|
### `label` (string)
|
|
114
166
|
|
|
115
|
-
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
167
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
168
|
+
|
|
169
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
170
|
+
|
|
171
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
172
|
+
|
|
173
|
+
### `teacherInstructions` (number)
|
|
174
|
+
|
|
175
|
+
Indicates the max dimension for images in teacher instructions
|
|
176
|
+
|
|
177
|
+
### `prompt` (number)
|
|
178
|
+
|
|
179
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
180
|
+
|
|
181
|
+
### `rationale` (number)
|
|
182
|
+
|
|
183
|
+
Indicates the max dimension for images in rationale
|
|
184
|
+
|
|
185
|
+
## `ConfigureWithForceProp` (object)
|
|
186
|
+
|
|
187
|
+
Properties of the `ConfigureWithForceProp` object:
|
|
188
|
+
|
|
189
|
+
### `settings` (boolean)
|
|
190
|
+
|
|
191
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
192
|
+
|
|
193
|
+
### `label` (string)
|
|
194
|
+
|
|
195
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
196
|
+
|
|
197
|
+
### `forceEnabled` (boolean)
|
|
198
|
+
|
|
199
|
+
Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
|
package/docs/demo/config.js
CHANGED
package/docs/demo/generate.js
CHANGED
|
@@ -3,9 +3,12 @@ exports.model = (id, element) => ({
|
|
|
3
3
|
element,
|
|
4
4
|
prompt: 'This is the question prompt',
|
|
5
5
|
promptEnabled: true,
|
|
6
|
+
backgroundImageEnabled: true,
|
|
7
|
+
toolbarEditorPosition: 'bottom',
|
|
6
8
|
imageUrl: '',
|
|
7
9
|
imageDimensions: {
|
|
8
10
|
height: 0,
|
|
9
|
-
width: 0
|
|
10
|
-
}
|
|
11
|
+
width: 0,
|
|
12
|
+
},
|
|
13
|
+
rubricEnabled: false,
|
|
11
14
|
});
|
package/docs/demo/session.js
CHANGED