@pie-element/match-list 1.12.3 → 1.12.4-next.1008
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 +68 -0
- package/controller/CHANGELOG.md +16 -0
- package/controller/lib/index.js +4 -3
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/lib/answer-area.js +3 -3
- package/lib/answer-area.js.map +1 -1
- package/lib/answer.js +2 -2
- package/lib/answer.js.map +1 -1
- package/lib/arrow.js +1 -1
- package/lib/arrow.js.map +1 -1
- package/lib/choices-list.js +1 -1
- package/lib/choices-list.js.map +1 -1
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/main.js +5 -10
- package/lib/main.js.map +1 -1
- package/package.json +5 -5
- package/module/controller.js +0 -19588
- package/module/demo.js +0 -86
- package/module/element.js +0 -1325
- package/module/index.html +0 -16
- package/module/manifest.json +0 -10
package/module/element.js
DELETED
|
@@ -1,1325 +0,0 @@
|
|
|
1
|
-
import {_dll_react, _dll_material_ui__core, _dll_prop_types, _dll_material_ui__core_styles, _dll_react_dnd, _dll_pie_lib__drag, _dll_lodash, _dll_pie_lib__render_ui, _dll_pie_lib__correct_answer_toggle, _dll_react_dom, _dll_pie_framework__pie_player_events, _dll_pie_lib__math_rendering} from "../../../@pie-ui/shared-lib@^4.3.3/module/index.js";
|
|
2
|
-
function unwrapExports(x) {
|
|
3
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
4
|
-
}
|
|
5
|
-
function createCommonjsModule(fn, module) {
|
|
6
|
-
return (module = {
|
|
7
|
-
exports: {}
|
|
8
|
-
}, fn(module, module.exports), module.exports);
|
|
9
|
-
}
|
|
10
|
-
var s = 1000;
|
|
11
|
-
var m = s * 60;
|
|
12
|
-
var h = m * 60;
|
|
13
|
-
var d = h * 24;
|
|
14
|
-
var w = d * 7;
|
|
15
|
-
var y = d * 365.25;
|
|
16
|
-
var ms = function (val, options) {
|
|
17
|
-
options = options || ({});
|
|
18
|
-
var type = typeof val;
|
|
19
|
-
if (type === 'string' && val.length > 0) {
|
|
20
|
-
return parse(val);
|
|
21
|
-
} else if (type === 'number' && isFinite(val)) {
|
|
22
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
23
|
-
}
|
|
24
|
-
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
|
|
25
|
-
};
|
|
26
|
-
function parse(str) {
|
|
27
|
-
str = String(str);
|
|
28
|
-
if (str.length > 100) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
var match = (/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i).exec(str);
|
|
32
|
-
if (!match) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
var n = parseFloat(match[1]);
|
|
36
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
37
|
-
switch (type) {
|
|
38
|
-
case 'years':
|
|
39
|
-
case 'year':
|
|
40
|
-
case 'yrs':
|
|
41
|
-
case 'yr':
|
|
42
|
-
case 'y':
|
|
43
|
-
return n * y;
|
|
44
|
-
case 'weeks':
|
|
45
|
-
case 'week':
|
|
46
|
-
case 'w':
|
|
47
|
-
return n * w;
|
|
48
|
-
case 'days':
|
|
49
|
-
case 'day':
|
|
50
|
-
case 'd':
|
|
51
|
-
return n * d;
|
|
52
|
-
case 'hours':
|
|
53
|
-
case 'hour':
|
|
54
|
-
case 'hrs':
|
|
55
|
-
case 'hr':
|
|
56
|
-
case 'h':
|
|
57
|
-
return n * h;
|
|
58
|
-
case 'minutes':
|
|
59
|
-
case 'minute':
|
|
60
|
-
case 'mins':
|
|
61
|
-
case 'min':
|
|
62
|
-
case 'm':
|
|
63
|
-
return n * m;
|
|
64
|
-
case 'seconds':
|
|
65
|
-
case 'second':
|
|
66
|
-
case 'secs':
|
|
67
|
-
case 'sec':
|
|
68
|
-
case 's':
|
|
69
|
-
return n * s;
|
|
70
|
-
case 'milliseconds':
|
|
71
|
-
case 'millisecond':
|
|
72
|
-
case 'msecs':
|
|
73
|
-
case 'msec':
|
|
74
|
-
case 'ms':
|
|
75
|
-
return n;
|
|
76
|
-
default:
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function fmtShort(ms) {
|
|
81
|
-
var msAbs = Math.abs(ms);
|
|
82
|
-
if (msAbs >= d) {
|
|
83
|
-
return Math.round(ms / d) + 'd';
|
|
84
|
-
}
|
|
85
|
-
if (msAbs >= h) {
|
|
86
|
-
return Math.round(ms / h) + 'h';
|
|
87
|
-
}
|
|
88
|
-
if (msAbs >= m) {
|
|
89
|
-
return Math.round(ms / m) + 'm';
|
|
90
|
-
}
|
|
91
|
-
if (msAbs >= s) {
|
|
92
|
-
return Math.round(ms / s) + 's';
|
|
93
|
-
}
|
|
94
|
-
return ms + 'ms';
|
|
95
|
-
}
|
|
96
|
-
function fmtLong(ms) {
|
|
97
|
-
var msAbs = Math.abs(ms);
|
|
98
|
-
if (msAbs >= d) {
|
|
99
|
-
return plural(ms, msAbs, d, 'day');
|
|
100
|
-
}
|
|
101
|
-
if (msAbs >= h) {
|
|
102
|
-
return plural(ms, msAbs, h, 'hour');
|
|
103
|
-
}
|
|
104
|
-
if (msAbs >= m) {
|
|
105
|
-
return plural(ms, msAbs, m, 'minute');
|
|
106
|
-
}
|
|
107
|
-
if (msAbs >= s) {
|
|
108
|
-
return plural(ms, msAbs, s, 'second');
|
|
109
|
-
}
|
|
110
|
-
return ms + ' ms';
|
|
111
|
-
}
|
|
112
|
-
function plural(ms, msAbs, n, name) {
|
|
113
|
-
var isPlural = msAbs >= n * 1.5;
|
|
114
|
-
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
115
|
-
}
|
|
116
|
-
function setup(env) {
|
|
117
|
-
createDebug.debug = createDebug;
|
|
118
|
-
createDebug.default = createDebug;
|
|
119
|
-
createDebug.coerce = coerce;
|
|
120
|
-
createDebug.disable = disable;
|
|
121
|
-
createDebug.enable = enable;
|
|
122
|
-
createDebug.enabled = enabled;
|
|
123
|
-
createDebug.humanize = ms;
|
|
124
|
-
createDebug.destroy = destroy;
|
|
125
|
-
Object.keys(env).forEach(key => {
|
|
126
|
-
createDebug[key] = env[key];
|
|
127
|
-
});
|
|
128
|
-
createDebug.names = [];
|
|
129
|
-
createDebug.skips = [];
|
|
130
|
-
createDebug.formatters = {};
|
|
131
|
-
function selectColor(namespace) {
|
|
132
|
-
let hash = 0;
|
|
133
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
134
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
135
|
-
hash |= 0;
|
|
136
|
-
}
|
|
137
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
138
|
-
}
|
|
139
|
-
createDebug.selectColor = selectColor;
|
|
140
|
-
function createDebug(namespace) {
|
|
141
|
-
let prevTime;
|
|
142
|
-
let enableOverride = null;
|
|
143
|
-
function debug(...args) {
|
|
144
|
-
if (!debug.enabled) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
const self = debug;
|
|
148
|
-
const curr = Number(new Date());
|
|
149
|
-
const ms = curr - (prevTime || curr);
|
|
150
|
-
self.diff = ms;
|
|
151
|
-
self.prev = prevTime;
|
|
152
|
-
self.curr = curr;
|
|
153
|
-
prevTime = curr;
|
|
154
|
-
args[0] = createDebug.coerce(args[0]);
|
|
155
|
-
if (typeof args[0] !== 'string') {
|
|
156
|
-
args.unshift('%O');
|
|
157
|
-
}
|
|
158
|
-
let index = 0;
|
|
159
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
160
|
-
if (match === '%%') {
|
|
161
|
-
return '%';
|
|
162
|
-
}
|
|
163
|
-
index++;
|
|
164
|
-
const formatter = createDebug.formatters[format];
|
|
165
|
-
if (typeof formatter === 'function') {
|
|
166
|
-
const val = args[index];
|
|
167
|
-
match = formatter.call(self, val);
|
|
168
|
-
args.splice(index, 1);
|
|
169
|
-
index--;
|
|
170
|
-
}
|
|
171
|
-
return match;
|
|
172
|
-
});
|
|
173
|
-
createDebug.formatArgs.call(self, args);
|
|
174
|
-
const logFn = self.log || createDebug.log;
|
|
175
|
-
logFn.apply(self, args);
|
|
176
|
-
}
|
|
177
|
-
debug.namespace = namespace;
|
|
178
|
-
debug.useColors = createDebug.useColors();
|
|
179
|
-
debug.color = createDebug.selectColor(namespace);
|
|
180
|
-
debug.extend = extend;
|
|
181
|
-
debug.destroy = createDebug.destroy;
|
|
182
|
-
Object.defineProperty(debug, 'enabled', {
|
|
183
|
-
enumerable: true,
|
|
184
|
-
configurable: false,
|
|
185
|
-
get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
|
|
186
|
-
set: v => {
|
|
187
|
-
enableOverride = v;
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
if (typeof createDebug.init === 'function') {
|
|
191
|
-
createDebug.init(debug);
|
|
192
|
-
}
|
|
193
|
-
return debug;
|
|
194
|
-
}
|
|
195
|
-
function extend(namespace, delimiter) {
|
|
196
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
197
|
-
newDebug.log = this.log;
|
|
198
|
-
return newDebug;
|
|
199
|
-
}
|
|
200
|
-
function enable(namespaces) {
|
|
201
|
-
createDebug.save(namespaces);
|
|
202
|
-
createDebug.names = [];
|
|
203
|
-
createDebug.skips = [];
|
|
204
|
-
let i;
|
|
205
|
-
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
206
|
-
const len = split.length;
|
|
207
|
-
for (i = 0; i < len; i++) {
|
|
208
|
-
if (!split[i]) {
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
|
212
|
-
if (namespaces[0] === '-') {
|
|
213
|
-
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|
214
|
-
} else {
|
|
215
|
-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
function disable() {
|
|
220
|
-
const namespaces = [...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)].join(',');
|
|
221
|
-
createDebug.enable('');
|
|
222
|
-
return namespaces;
|
|
223
|
-
}
|
|
224
|
-
function enabled(name) {
|
|
225
|
-
if (name[name.length - 1] === '*') {
|
|
226
|
-
return true;
|
|
227
|
-
}
|
|
228
|
-
let i;
|
|
229
|
-
let len;
|
|
230
|
-
for ((i = 0, len = createDebug.skips.length); i < len; i++) {
|
|
231
|
-
if (createDebug.skips[i].test(name)) {
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
for ((i = 0, len = createDebug.names.length); i < len; i++) {
|
|
236
|
-
if (createDebug.names[i].test(name)) {
|
|
237
|
-
return true;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
function toNamespace(regexp) {
|
|
243
|
-
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
|
|
244
|
-
}
|
|
245
|
-
function coerce(val) {
|
|
246
|
-
if (val instanceof Error) {
|
|
247
|
-
return val.stack || val.message;
|
|
248
|
-
}
|
|
249
|
-
return val;
|
|
250
|
-
}
|
|
251
|
-
function destroy() {
|
|
252
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
253
|
-
}
|
|
254
|
-
createDebug.enable(createDebug.load());
|
|
255
|
-
return createDebug;
|
|
256
|
-
}
|
|
257
|
-
var common = setup;
|
|
258
|
-
var browser = createCommonjsModule(function (module, exports) {
|
|
259
|
-
exports.formatArgs = formatArgs;
|
|
260
|
-
exports.save = save;
|
|
261
|
-
exports.load = load;
|
|
262
|
-
exports.useColors = useColors;
|
|
263
|
-
exports.storage = localstorage();
|
|
264
|
-
exports.destroy = (() => {
|
|
265
|
-
let warned = false;
|
|
266
|
-
return () => {
|
|
267
|
-
if (!warned) {
|
|
268
|
-
warned = true;
|
|
269
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
})();
|
|
273
|
-
exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
|
|
274
|
-
function useColors() {
|
|
275
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
279
|
-
return false;
|
|
280
|
-
}
|
|
281
|
-
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
282
|
-
}
|
|
283
|
-
function formatArgs(args) {
|
|
284
|
-
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
|
285
|
-
if (!this.useColors) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
const c = 'color: ' + this.color;
|
|
289
|
-
args.splice(1, 0, c, 'color: inherit');
|
|
290
|
-
let index = 0;
|
|
291
|
-
let lastC = 0;
|
|
292
|
-
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
293
|
-
if (match === '%%') {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
index++;
|
|
297
|
-
if (match === '%c') {
|
|
298
|
-
lastC = index;
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
args.splice(lastC, 0, c);
|
|
302
|
-
}
|
|
303
|
-
exports.log = console.debug || console.log || (() => {});
|
|
304
|
-
function save(namespaces) {
|
|
305
|
-
try {
|
|
306
|
-
if (namespaces) {
|
|
307
|
-
exports.storage.setItem('debug', namespaces);
|
|
308
|
-
} else {
|
|
309
|
-
exports.storage.removeItem('debug');
|
|
310
|
-
}
|
|
311
|
-
} catch (error) {}
|
|
312
|
-
}
|
|
313
|
-
function load() {
|
|
314
|
-
let r;
|
|
315
|
-
try {
|
|
316
|
-
r = exports.storage.getItem('debug');
|
|
317
|
-
} catch (error) {}
|
|
318
|
-
if (!r && typeof process !== 'undefined' && ('env' in process)) {
|
|
319
|
-
r = process.env.DEBUG;
|
|
320
|
-
}
|
|
321
|
-
return r;
|
|
322
|
-
}
|
|
323
|
-
function localstorage() {
|
|
324
|
-
try {
|
|
325
|
-
return localStorage;
|
|
326
|
-
} catch (error) {}
|
|
327
|
-
}
|
|
328
|
-
module.exports = common(exports);
|
|
329
|
-
const {formatters} = module.exports;
|
|
330
|
-
formatters.j = function (v) {
|
|
331
|
-
try {
|
|
332
|
-
return JSON.stringify(v);
|
|
333
|
-
} catch (error) {
|
|
334
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
});
|
|
338
|
-
browser.formatArgs;
|
|
339
|
-
browser.save;
|
|
340
|
-
browser.load;
|
|
341
|
-
browser.useColors;
|
|
342
|
-
browser.storage;
|
|
343
|
-
browser.destroy;
|
|
344
|
-
browser.colors;
|
|
345
|
-
browser.log;
|
|
346
|
-
var classnames = createCommonjsModule(function (module) {
|
|
347
|
-
(function () {
|
|
348
|
-
var hasOwn = ({}).hasOwnProperty;
|
|
349
|
-
function classNames() {
|
|
350
|
-
var classes = [];
|
|
351
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
352
|
-
var arg = arguments[i];
|
|
353
|
-
if (!arg) continue;
|
|
354
|
-
var argType = typeof arg;
|
|
355
|
-
if (argType === 'string' || argType === 'number') {
|
|
356
|
-
classes.push(arg);
|
|
357
|
-
} else if (Array.isArray(arg) && arg.length) {
|
|
358
|
-
var inner = classNames.apply(null, arg);
|
|
359
|
-
if (inner) {
|
|
360
|
-
classes.push(inner);
|
|
361
|
-
}
|
|
362
|
-
} else if (argType === 'object') {
|
|
363
|
-
for (var key in arg) {
|
|
364
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
365
|
-
classes.push(key);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return classes.join(' ');
|
|
371
|
-
}
|
|
372
|
-
if (module.exports) {
|
|
373
|
-
classNames.default = classNames;
|
|
374
|
-
module.exports = classNames;
|
|
375
|
-
} else {
|
|
376
|
-
window.classNames = classNames;
|
|
377
|
-
}
|
|
378
|
-
})();
|
|
379
|
-
});
|
|
380
|
-
var interopRequireDefault = createCommonjsModule(function (module) {
|
|
381
|
-
function _interopRequireDefault(obj) {
|
|
382
|
-
return obj && obj.__esModule ? obj : {
|
|
383
|
-
"default": obj
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
module.exports = _interopRequireDefault;
|
|
387
|
-
});
|
|
388
|
-
unwrapExports(interopRequireDefault);
|
|
389
|
-
var setPrototypeOf = createCommonjsModule(function (module) {
|
|
390
|
-
function _setPrototypeOf(o, p) {
|
|
391
|
-
module.exports = _setPrototypeOf = Object.setPrototypeOf || (function _setPrototypeOf(o, p) {
|
|
392
|
-
o.__proto__ = p;
|
|
393
|
-
return o;
|
|
394
|
-
});
|
|
395
|
-
return _setPrototypeOf(o, p);
|
|
396
|
-
}
|
|
397
|
-
module.exports = _setPrototypeOf;
|
|
398
|
-
});
|
|
399
|
-
function _inheritsLoose(subClass, superClass) {
|
|
400
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
401
|
-
subClass.prototype.constructor = subClass;
|
|
402
|
-
setPrototypeOf(subClass, superClass);
|
|
403
|
-
}
|
|
404
|
-
var inheritsLoose = _inheritsLoose;
|
|
405
|
-
var setStatic_1 = createCommonjsModule(function (module, exports) {
|
|
406
|
-
exports.__esModule = true;
|
|
407
|
-
exports.default = void 0;
|
|
408
|
-
var setStatic = function setStatic(key, value) {
|
|
409
|
-
return function (BaseComponent) {
|
|
410
|
-
BaseComponent[key] = value;
|
|
411
|
-
return BaseComponent;
|
|
412
|
-
};
|
|
413
|
-
};
|
|
414
|
-
var _default = setStatic;
|
|
415
|
-
exports.default = _default;
|
|
416
|
-
});
|
|
417
|
-
unwrapExports(setStatic_1);
|
|
418
|
-
var setDisplayName_1 = createCommonjsModule(function (module, exports) {
|
|
419
|
-
exports.__esModule = true;
|
|
420
|
-
exports.default = void 0;
|
|
421
|
-
var _setStatic = interopRequireDefault(setStatic_1);
|
|
422
|
-
var setDisplayName = function setDisplayName(displayName) {
|
|
423
|
-
return (0, _setStatic.default)('displayName', displayName);
|
|
424
|
-
};
|
|
425
|
-
var _default = setDisplayName;
|
|
426
|
-
exports.default = _default;
|
|
427
|
-
});
|
|
428
|
-
unwrapExports(setDisplayName_1);
|
|
429
|
-
var getDisplayName_1 = createCommonjsModule(function (module, exports) {
|
|
430
|
-
exports.__esModule = true;
|
|
431
|
-
exports.default = void 0;
|
|
432
|
-
var getDisplayName = function getDisplayName(Component) {
|
|
433
|
-
if (typeof Component === 'string') {
|
|
434
|
-
return Component;
|
|
435
|
-
}
|
|
436
|
-
if (!Component) {
|
|
437
|
-
return undefined;
|
|
438
|
-
}
|
|
439
|
-
return Component.displayName || Component.name || 'Component';
|
|
440
|
-
};
|
|
441
|
-
var _default = getDisplayName;
|
|
442
|
-
exports.default = _default;
|
|
443
|
-
});
|
|
444
|
-
unwrapExports(getDisplayName_1);
|
|
445
|
-
var wrapDisplayName_1 = createCommonjsModule(function (module, exports) {
|
|
446
|
-
exports.__esModule = true;
|
|
447
|
-
exports.default = void 0;
|
|
448
|
-
var _getDisplayName = interopRequireDefault(getDisplayName_1);
|
|
449
|
-
var wrapDisplayName = function wrapDisplayName(BaseComponent, hocName) {
|
|
450
|
-
return hocName + "(" + (0, _getDisplayName.default)(BaseComponent) + ")";
|
|
451
|
-
};
|
|
452
|
-
var _default = wrapDisplayName;
|
|
453
|
-
exports.default = _default;
|
|
454
|
-
});
|
|
455
|
-
unwrapExports(wrapDisplayName_1);
|
|
456
|
-
const _react = _dll_react;
|
|
457
|
-
var shouldUpdate_1 = createCommonjsModule(function (module, exports) {
|
|
458
|
-
exports.__esModule = true;
|
|
459
|
-
exports.default = void 0;
|
|
460
|
-
var _inheritsLoose2 = interopRequireDefault(inheritsLoose);
|
|
461
|
-
var _setDisplayName = interopRequireDefault(setDisplayName_1);
|
|
462
|
-
var _wrapDisplayName = interopRequireDefault(wrapDisplayName_1);
|
|
463
|
-
var shouldUpdate = function shouldUpdate(test) {
|
|
464
|
-
return function (BaseComponent) {
|
|
465
|
-
var factory = (0, _react.createFactory)(BaseComponent);
|
|
466
|
-
var ShouldUpdate = (function (_Component) {
|
|
467
|
-
(0, _inheritsLoose2.default)(ShouldUpdate, _Component);
|
|
468
|
-
function ShouldUpdate() {
|
|
469
|
-
return _Component.apply(this, arguments) || this;
|
|
470
|
-
}
|
|
471
|
-
var _proto = ShouldUpdate.prototype;
|
|
472
|
-
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
|
473
|
-
return test(this.props, nextProps);
|
|
474
|
-
};
|
|
475
|
-
_proto.render = function render() {
|
|
476
|
-
return factory(this.props);
|
|
477
|
-
};
|
|
478
|
-
return ShouldUpdate;
|
|
479
|
-
})(_react.Component);
|
|
480
|
-
{
|
|
481
|
-
return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'shouldUpdate'))(ShouldUpdate);
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
};
|
|
485
|
-
var _default = shouldUpdate;
|
|
486
|
-
exports.default = _default;
|
|
487
|
-
});
|
|
488
|
-
unwrapExports(shouldUpdate_1);
|
|
489
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
490
|
-
function is(x, y) {
|
|
491
|
-
if (x === y) {
|
|
492
|
-
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
493
|
-
} else {
|
|
494
|
-
return x !== x && y !== y;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
function shallowEqual(objA, objB) {
|
|
498
|
-
if (is(objA, objB)) {
|
|
499
|
-
return true;
|
|
500
|
-
}
|
|
501
|
-
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
|
502
|
-
return false;
|
|
503
|
-
}
|
|
504
|
-
var keysA = Object.keys(objA);
|
|
505
|
-
var keysB = Object.keys(objB);
|
|
506
|
-
if (keysA.length !== keysB.length) {
|
|
507
|
-
return false;
|
|
508
|
-
}
|
|
509
|
-
for (var i = 0; i < keysA.length; i++) {
|
|
510
|
-
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
|
511
|
-
return false;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
return true;
|
|
515
|
-
}
|
|
516
|
-
var shallowEqual_1 = shallowEqual;
|
|
517
|
-
var shallowEqual$1 = createCommonjsModule(function (module, exports) {
|
|
518
|
-
exports.__esModule = true;
|
|
519
|
-
exports.default = void 0;
|
|
520
|
-
var _shallowEqual = interopRequireDefault(shallowEqual_1);
|
|
521
|
-
var _default = _shallowEqual.default;
|
|
522
|
-
exports.default = _default;
|
|
523
|
-
});
|
|
524
|
-
unwrapExports(shallowEqual$1);
|
|
525
|
-
var pure_1 = createCommonjsModule(function (module, exports) {
|
|
526
|
-
exports.__esModule = true;
|
|
527
|
-
exports.default = void 0;
|
|
528
|
-
var _shouldUpdate = interopRequireDefault(shouldUpdate_1);
|
|
529
|
-
var _shallowEqual = interopRequireDefault(shallowEqual$1);
|
|
530
|
-
var _setDisplayName = interopRequireDefault(setDisplayName_1);
|
|
531
|
-
var _wrapDisplayName = interopRequireDefault(wrapDisplayName_1);
|
|
532
|
-
var pure = function pure(BaseComponent) {
|
|
533
|
-
var hoc = (0, _shouldUpdate.default)(function (props, nextProps) {
|
|
534
|
-
return !(0, _shallowEqual.default)(props, nextProps);
|
|
535
|
-
});
|
|
536
|
-
{
|
|
537
|
-
return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'pure'))(hoc(BaseComponent));
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
var _default = pure;
|
|
541
|
-
exports.default = _default;
|
|
542
|
-
});
|
|
543
|
-
unwrapExports(pure_1);
|
|
544
|
-
const require$$0 = _dll_react;
|
|
545
|
-
const {SvgIcon: require$$2} = _dll_material_ui__core;
|
|
546
|
-
var createSvgIcon_1 = createCommonjsModule(function (module, exports) {
|
|
547
|
-
Object.defineProperty(exports, "__esModule", {
|
|
548
|
-
value: true
|
|
549
|
-
});
|
|
550
|
-
exports.default = void 0;
|
|
551
|
-
var _react = interopRequireDefault(require$$0);
|
|
552
|
-
var _pure = interopRequireDefault(pure_1);
|
|
553
|
-
var _SvgIcon = interopRequireDefault(require$$2);
|
|
554
|
-
function createSvgIcon(path, displayName) {
|
|
555
|
-
var Icon = function Icon(props) {
|
|
556
|
-
return _react.default.createElement(_SvgIcon.default, props, path);
|
|
557
|
-
};
|
|
558
|
-
Icon.displayName = ("").concat(displayName, "Icon");
|
|
559
|
-
Icon = (0, _pure.default)(Icon);
|
|
560
|
-
Icon.muiName = 'SvgIcon';
|
|
561
|
-
return Icon;
|
|
562
|
-
}
|
|
563
|
-
var _default = createSvgIcon;
|
|
564
|
-
exports.default = _default;
|
|
565
|
-
});
|
|
566
|
-
unwrapExports(createSvgIcon_1);
|
|
567
|
-
const require$$0$1 = _dll_react;
|
|
568
|
-
var ArrowDropDown = createCommonjsModule(function (module, exports) {
|
|
569
|
-
Object.defineProperty(exports, "__esModule", {
|
|
570
|
-
value: true
|
|
571
|
-
});
|
|
572
|
-
exports.default = void 0;
|
|
573
|
-
var _react = interopRequireDefault(require$$0$1);
|
|
574
|
-
var _createSvgIcon = interopRequireDefault(createSvgIcon_1);
|
|
575
|
-
var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
|
|
576
|
-
d: "M7 10l5 5 5-5z"
|
|
577
|
-
}), _react.default.createElement("path", {
|
|
578
|
-
fill: "none",
|
|
579
|
-
d: "M0 0h24v24H0z"
|
|
580
|
-
})), 'ArrowDropDown');
|
|
581
|
-
exports.default = _default;
|
|
582
|
-
});
|
|
583
|
-
var ArrowHead = unwrapExports(ArrowDropDown);
|
|
584
|
-
const React = _dll_react;
|
|
585
|
-
const PropTypes = _dll_prop_types;
|
|
586
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
587
|
-
const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/match-list/src/arrow.js";
|
|
588
|
-
class Arrow extends React.Component {
|
|
589
|
-
static __initStatic() {
|
|
590
|
-
this.propTypes = {
|
|
591
|
-
direction: PropTypes.string,
|
|
592
|
-
classes: PropTypes.object.isRequired
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
render() {
|
|
596
|
-
const {direction, classes} = this.props;
|
|
597
|
-
const extraStyle = direction === 'left' ? {} : {
|
|
598
|
-
transform: 'rotate(180deg)'
|
|
599
|
-
};
|
|
600
|
-
return React.createElement('div', {
|
|
601
|
-
className: classes.arrow,
|
|
602
|
-
style: extraStyle,
|
|
603
|
-
__self: this,
|
|
604
|
-
__source: {
|
|
605
|
-
fileName: _jsxFileName,
|
|
606
|
-
lineNumber: 23
|
|
607
|
-
}
|
|
608
|
-
}, React.createElement(ArrowHead, {
|
|
609
|
-
style: {
|
|
610
|
-
transform: 'rotate(90deg)',
|
|
611
|
-
color: '#979797',
|
|
612
|
-
fontSize: 40
|
|
613
|
-
},
|
|
614
|
-
__self: this,
|
|
615
|
-
__source: {
|
|
616
|
-
fileName: _jsxFileName,
|
|
617
|
-
lineNumber: 27
|
|
618
|
-
}
|
|
619
|
-
}), React.createElement('span', {
|
|
620
|
-
className: classnames(classes.line, {
|
|
621
|
-
[classes.right]: direction !== 'left'
|
|
622
|
-
}),
|
|
623
|
-
__self: this,
|
|
624
|
-
__source: {
|
|
625
|
-
fileName: _jsxFileName,
|
|
626
|
-
lineNumber: 34
|
|
627
|
-
}
|
|
628
|
-
}));
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
Arrow.__initStatic();
|
|
632
|
-
const styledArrow = withStyles({
|
|
633
|
-
arrow: {
|
|
634
|
-
display: 'inline-block',
|
|
635
|
-
position: 'relative',
|
|
636
|
-
width: '100%'
|
|
637
|
-
},
|
|
638
|
-
line: {
|
|
639
|
-
backgroundColor: '#979797',
|
|
640
|
-
bottom: 19,
|
|
641
|
-
content: '""',
|
|
642
|
-
display: 'block',
|
|
643
|
-
height: 1,
|
|
644
|
-
left: 20,
|
|
645
|
-
position: 'absolute',
|
|
646
|
-
width: '100%'
|
|
647
|
-
},
|
|
648
|
-
right: {
|
|
649
|
-
bottom: 20
|
|
650
|
-
}
|
|
651
|
-
})(Arrow);
|
|
652
|
-
const {DragSource: DragSource} = _dll_react_dnd;
|
|
653
|
-
const {DropTarget: DropTarget} = _dll_react_dnd;
|
|
654
|
-
const PropTypes$1 = _dll_prop_types;
|
|
655
|
-
const React$1 = _dll_react;
|
|
656
|
-
const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
|
|
657
|
-
const {PlaceHolder: PlaceHolder} = _dll_pie_lib__drag;
|
|
658
|
-
const {isEmpty: isEmpty} = _dll_lodash;
|
|
659
|
-
const {color: color} = _dll_pie_lib__render_ui;
|
|
660
|
-
const _jsxFileName$1 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/match-list/src/answer.js";
|
|
661
|
-
const log = browser('pie-elements:match-title:answer');
|
|
662
|
-
const Holder = withStyles$1(() => ({
|
|
663
|
-
number: {
|
|
664
|
-
width: '100%',
|
|
665
|
-
fontSize: '18px',
|
|
666
|
-
textAlign: 'center',
|
|
667
|
-
color: 'rgba(0,0,0,0.6)'
|
|
668
|
-
},
|
|
669
|
-
placeholder: {
|
|
670
|
-
display: 'flex',
|
|
671
|
-
padding: '0',
|
|
672
|
-
alignItems: 'center',
|
|
673
|
-
justifyContent: 'center',
|
|
674
|
-
height: '40px'
|
|
675
|
-
}
|
|
676
|
-
}))(({classes, index, isOver, disabled}) => React$1.createElement(PlaceHolder, {
|
|
677
|
-
className: classes.placeholder,
|
|
678
|
-
disabled: disabled,
|
|
679
|
-
isOver: isOver,
|
|
680
|
-
__self: undefined,
|
|
681
|
-
__source: {
|
|
682
|
-
fileName: _jsxFileName$1,
|
|
683
|
-
lineNumber: 29
|
|
684
|
-
}
|
|
685
|
-
}, index !== undefined && React$1.createElement('div', {
|
|
686
|
-
className: classes.number,
|
|
687
|
-
__self: undefined,
|
|
688
|
-
__source: {
|
|
689
|
-
fileName: _jsxFileName$1,
|
|
690
|
-
lineNumber: 34
|
|
691
|
-
}
|
|
692
|
-
}, index)));
|
|
693
|
-
Holder.propTypes = {
|
|
694
|
-
index: PropTypes$1.number,
|
|
695
|
-
isOver: PropTypes$1.bool,
|
|
696
|
-
disabled: PropTypes$1.bool
|
|
697
|
-
};
|
|
698
|
-
const AnswerContent = withStyles$1({
|
|
699
|
-
over: {
|
|
700
|
-
opacity: 0.2
|
|
701
|
-
},
|
|
702
|
-
answerContent: {
|
|
703
|
-
color: color.text(),
|
|
704
|
-
backgroundColor: color.background(),
|
|
705
|
-
border: '1px solid #c2c2c2',
|
|
706
|
-
cursor: 'pointer',
|
|
707
|
-
width: '100%',
|
|
708
|
-
padding: '10px',
|
|
709
|
-
boxSizing: 'border-box',
|
|
710
|
-
overflow: 'hidden',
|
|
711
|
-
transition: 'opacity 200ms linear',
|
|
712
|
-
wordBreak: 'break-word'
|
|
713
|
-
},
|
|
714
|
-
dragging: {
|
|
715
|
-
opacity: 0.5
|
|
716
|
-
},
|
|
717
|
-
disabled: {
|
|
718
|
-
backgroundColor: color.background(),
|
|
719
|
-
opacity: 0.6,
|
|
720
|
-
cursor: 'not-allowed'
|
|
721
|
-
},
|
|
722
|
-
incorrect: {
|
|
723
|
-
border: `1px solid ${color.incorrect()}`
|
|
724
|
-
},
|
|
725
|
-
correct: {
|
|
726
|
-
border: `1px solid ${color.correct()}`
|
|
727
|
-
}
|
|
728
|
-
})(props => {
|
|
729
|
-
const {classes, isDragging, isOver, title, disabled, empty, outcome, guideIndex, type} = props;
|
|
730
|
-
if (empty) {
|
|
731
|
-
return React$1.createElement(Holder, {
|
|
732
|
-
index: guideIndex,
|
|
733
|
-
isOver: isOver,
|
|
734
|
-
disabled: disabled,
|
|
735
|
-
type: type,
|
|
736
|
-
__self: undefined,
|
|
737
|
-
__source: {
|
|
738
|
-
fileName: _jsxFileName$1,
|
|
739
|
-
lineNumber: 89
|
|
740
|
-
}
|
|
741
|
-
});
|
|
742
|
-
} else {
|
|
743
|
-
const names = classnames(classes.answerContent, isDragging && !disabled && classes.dragging, isOver && !disabled && classes.over, disabled && classes.disabled, outcome && classes[outcome]);
|
|
744
|
-
return React$1.createElement('div', {
|
|
745
|
-
className: names,
|
|
746
|
-
dangerouslySetInnerHTML: {
|
|
747
|
-
__html: title
|
|
748
|
-
},
|
|
749
|
-
__self: undefined,
|
|
750
|
-
__source: {
|
|
751
|
-
fileName: _jsxFileName$1,
|
|
752
|
-
lineNumber: 106
|
|
753
|
-
}
|
|
754
|
-
});
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
class Answer extends React$1.Component {
|
|
758
|
-
static __initStatic() {
|
|
759
|
-
this.propTypes = {
|
|
760
|
-
className: PropTypes$1.string,
|
|
761
|
-
connectDragSource: PropTypes$1.func,
|
|
762
|
-
connectDropTarget: PropTypes$1.func,
|
|
763
|
-
isDragging: PropTypes$1.bool.isRequired,
|
|
764
|
-
id: PropTypes$1.any,
|
|
765
|
-
title: PropTypes$1.string,
|
|
766
|
-
isOver: PropTypes$1.bool,
|
|
767
|
-
classes: PropTypes$1.object.isRequired,
|
|
768
|
-
empty: PropTypes$1.bool,
|
|
769
|
-
type: PropTypes$1.string,
|
|
770
|
-
disabled: PropTypes$1.bool,
|
|
771
|
-
correct: PropTypes$1.bool
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
render() {
|
|
775
|
-
const {id, title, isDragging, className, connectDragSource, connectDropTarget, disabled, classes, isOver, type, correct} = this.props;
|
|
776
|
-
log('[render], props: ', this.props);
|
|
777
|
-
const name = classnames(className, classes.answer, {
|
|
778
|
-
[classes.correct]: correct === true,
|
|
779
|
-
[classes.incorrect]: correct === false
|
|
780
|
-
});
|
|
781
|
-
const content = React$1.createElement('div', {
|
|
782
|
-
className: name,
|
|
783
|
-
__self: this,
|
|
784
|
-
__source: {
|
|
785
|
-
fileName: _jsxFileName$1,
|
|
786
|
-
lineNumber: 150
|
|
787
|
-
}
|
|
788
|
-
}, React$1.createElement(AnswerContent, {
|
|
789
|
-
title: title,
|
|
790
|
-
id: id,
|
|
791
|
-
isOver: isOver,
|
|
792
|
-
empty: isEmpty(title),
|
|
793
|
-
isDragging: isDragging,
|
|
794
|
-
disabled: disabled,
|
|
795
|
-
type: type,
|
|
796
|
-
__self: this,
|
|
797
|
-
__source: {
|
|
798
|
-
fileName: _jsxFileName$1,
|
|
799
|
-
lineNumber: 151
|
|
800
|
-
}
|
|
801
|
-
}));
|
|
802
|
-
const droppable = connectDropTarget ? connectDropTarget(content) : content;
|
|
803
|
-
return connectDragSource ? connectDragSource(droppable) : droppable;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
Answer.__initStatic();
|
|
807
|
-
const StyledAnswer = withStyles$1({
|
|
808
|
-
answer: {
|
|
809
|
-
boxSizing: 'border-box',
|
|
810
|
-
minHeight: 40,
|
|
811
|
-
minWidth: '100px',
|
|
812
|
-
overflow: 'hidden',
|
|
813
|
-
margin: '10px 0',
|
|
814
|
-
padding: '0px',
|
|
815
|
-
textAlign: 'center'
|
|
816
|
-
},
|
|
817
|
-
incorrect: {
|
|
818
|
-
border: `1px solid var(--feedback-incorrect-bg-color, ${color.incorrect()})`
|
|
819
|
-
},
|
|
820
|
-
correct: {
|
|
821
|
-
border: `1px solid var(--feedback-correct-bg-color, ${color.correct()})`
|
|
822
|
-
}
|
|
823
|
-
})(Answer);
|
|
824
|
-
const answerTarget = {
|
|
825
|
-
drop(props, monitor) {
|
|
826
|
-
const draggedItem = monitor.getItem();
|
|
827
|
-
if (draggedItem.instanceId === props.instanceId) {
|
|
828
|
-
props.onPlaceAnswer(props.promptId, draggedItem.id);
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
canDrop(props, monitor) {
|
|
832
|
-
const draggedItem = monitor.getItem();
|
|
833
|
-
return draggedItem.instanceId === props.instanceId;
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
const DropAnswer = DropTarget('Answer', answerTarget, (connect, monitor) => ({
|
|
837
|
-
connectDropTarget: connect.dropTarget(),
|
|
838
|
-
isOver: monitor.isOver()
|
|
839
|
-
}))(StyledAnswer);
|
|
840
|
-
const answerSource = {
|
|
841
|
-
canDrag(props) {
|
|
842
|
-
return props.draggable && !props.disabled;
|
|
843
|
-
},
|
|
844
|
-
beginDrag(props) {
|
|
845
|
-
return {
|
|
846
|
-
id: props.id,
|
|
847
|
-
type: props.type,
|
|
848
|
-
instanceId: props.instanceId
|
|
849
|
-
};
|
|
850
|
-
},
|
|
851
|
-
endDrag(props, monitor) {
|
|
852
|
-
if (!monitor.didDrop()) {
|
|
853
|
-
if (props.type === 'target') {
|
|
854
|
-
props.onRemoveChoice(monitor.getItem());
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
const DragAnswer = DragSource('Answer', answerSource, (connect, monitor) => ({
|
|
860
|
-
connectDragSource: connect.dragSource(),
|
|
861
|
-
isDragging: monitor.isDragging()
|
|
862
|
-
}))(StyledAnswer);
|
|
863
|
-
const DragAndDropAnswer = DragSource('Answer', answerSource, (connect, monitor) => ({
|
|
864
|
-
connectDragSource: connect.dragSource(),
|
|
865
|
-
isDragging: monitor.isDragging()
|
|
866
|
-
}))(DropAnswer);
|
|
867
|
-
const React$2 = _dll_react;
|
|
868
|
-
const PropTypes$2 = _dll_prop_types;
|
|
869
|
-
const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
|
|
870
|
-
const {isEmpty: isEmpty$1} = _dll_lodash;
|
|
871
|
-
const {isUndefined: isUndefined} = _dll_lodash;
|
|
872
|
-
const {reduce: reduce} = _dll_lodash;
|
|
873
|
-
const _jsxFileName$2 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/match-list/src/answer-area.jsx";
|
|
874
|
-
class AnswerArea extends React$2.Component {
|
|
875
|
-
constructor(...args) {
|
|
876
|
-
super(...args);
|
|
877
|
-
AnswerArea.prototype.__init.call(this);
|
|
878
|
-
AnswerArea.prototype.__init2.call(this);
|
|
879
|
-
AnswerArea.prototype.__init3.call(this);
|
|
880
|
-
}
|
|
881
|
-
static __initStatic() {
|
|
882
|
-
this.propTypes = {
|
|
883
|
-
classes: PropTypes$2.object,
|
|
884
|
-
session: PropTypes$2.object.isRequired,
|
|
885
|
-
showCorrect: PropTypes$2.bool.isRequired,
|
|
886
|
-
disabled: PropTypes$2.bool.isRequired,
|
|
887
|
-
onSessionChange: PropTypes$2.func,
|
|
888
|
-
onRemoveAnswer: PropTypes$2.func,
|
|
889
|
-
onPlaceAnswer: PropTypes$2.func.isRequired,
|
|
890
|
-
instanceId: PropTypes$2.string.isRequired,
|
|
891
|
-
model: PropTypes$2.object.isRequired,
|
|
892
|
-
prompt: PropTypes$2.string
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
__init() {
|
|
896
|
-
this.getAnswerFromSession = promptId => {
|
|
897
|
-
const {model, session, showCorrect} = this.props;
|
|
898
|
-
const {config} = model;
|
|
899
|
-
const answerId = showCorrect ? config.prompts.find(p => p.id === promptId).relatedAnswer : session.value && session.value[promptId];
|
|
900
|
-
const answer = config.answers.find(answer => answer.id === answerId);
|
|
901
|
-
return answer || ({});
|
|
902
|
-
};
|
|
903
|
-
}
|
|
904
|
-
__init2() {
|
|
905
|
-
this.getCorrectOrIncorrectMap = () => {
|
|
906
|
-
const {model, session, showCorrect} = this.props;
|
|
907
|
-
const {config} = model;
|
|
908
|
-
const sessionValue = session.value || config.prompts.reduce((obj, prompt) => {
|
|
909
|
-
obj[prompt.id] = undefined;
|
|
910
|
-
return obj;
|
|
911
|
-
}, {});
|
|
912
|
-
if (model.mode !== 'evaluate') {
|
|
913
|
-
return {};
|
|
914
|
-
}
|
|
915
|
-
if (showCorrect) {
|
|
916
|
-
return config.prompts.reduce((obj, prompt) => {
|
|
917
|
-
obj[prompt.id] = true;
|
|
918
|
-
return obj;
|
|
919
|
-
}, {});
|
|
920
|
-
}
|
|
921
|
-
const correctPromptMap = config.prompts.reduce((obj, prompt) => {
|
|
922
|
-
if (!isUndefined(prompt.relatedAnswer)) {
|
|
923
|
-
obj[prompt.id] = prompt.relatedAnswer;
|
|
924
|
-
}
|
|
925
|
-
return obj;
|
|
926
|
-
}, {});
|
|
927
|
-
return reduce(sessionValue, (obj, val, key) => {
|
|
928
|
-
obj[key] = correctPromptMap[key] === sessionValue[key];
|
|
929
|
-
return obj;
|
|
930
|
-
}, {});
|
|
931
|
-
};
|
|
932
|
-
}
|
|
933
|
-
__init3() {
|
|
934
|
-
this.buildRows = () => {
|
|
935
|
-
const {model} = this.props;
|
|
936
|
-
const {config} = model;
|
|
937
|
-
const prompts = config.prompts || [];
|
|
938
|
-
return prompts.map(prompt => {
|
|
939
|
-
const sessionAnswer = this.getAnswerFromSession(prompt.id);
|
|
940
|
-
return {
|
|
941
|
-
...prompt,
|
|
942
|
-
sessionAnswer
|
|
943
|
-
};
|
|
944
|
-
});
|
|
945
|
-
};
|
|
946
|
-
}
|
|
947
|
-
render() {
|
|
948
|
-
const {classes, disabled, onPlaceAnswer, instanceId, onRemoveAnswer} = this.props;
|
|
949
|
-
const rows = this.buildRows();
|
|
950
|
-
const correctnessMap = this.getCorrectOrIncorrectMap();
|
|
951
|
-
return React$2.createElement('div', {
|
|
952
|
-
className: classes.itemList,
|
|
953
|
-
__self: this,
|
|
954
|
-
__source: {
|
|
955
|
-
fileName: _jsxFileName$2,
|
|
956
|
-
lineNumber: 99
|
|
957
|
-
}
|
|
958
|
-
}, rows.map(({sessionAnswer, title, id}, index) => {
|
|
959
|
-
return React$2.createElement('div', {
|
|
960
|
-
className: classes.row,
|
|
961
|
-
style: {
|
|
962
|
-
display: 'flex'
|
|
963
|
-
},
|
|
964
|
-
key: index,
|
|
965
|
-
__self: this,
|
|
966
|
-
__source: {
|
|
967
|
-
fileName: _jsxFileName$2,
|
|
968
|
-
lineNumber: 103
|
|
969
|
-
}
|
|
970
|
-
}, React$2.createElement('div', {
|
|
971
|
-
className: classes.promptEntry,
|
|
972
|
-
dangerouslySetInnerHTML: {
|
|
973
|
-
__html: title
|
|
974
|
-
},
|
|
975
|
-
__self: this,
|
|
976
|
-
__source: {
|
|
977
|
-
fileName: _jsxFileName$2,
|
|
978
|
-
lineNumber: 110
|
|
979
|
-
}
|
|
980
|
-
}), React$2.createElement('div', {
|
|
981
|
-
className: classes.arrowEntry,
|
|
982
|
-
__self: this,
|
|
983
|
-
__source: {
|
|
984
|
-
fileName: _jsxFileName$2,
|
|
985
|
-
lineNumber: 114
|
|
986
|
-
}
|
|
987
|
-
}, React$2.createElement(styledArrow, {
|
|
988
|
-
direction: "left",
|
|
989
|
-
__self: this,
|
|
990
|
-
__source: {
|
|
991
|
-
fileName: _jsxFileName$2,
|
|
992
|
-
lineNumber: 117
|
|
993
|
-
}
|
|
994
|
-
}), React$2.createElement(styledArrow, {
|
|
995
|
-
__self: this,
|
|
996
|
-
__source: {
|
|
997
|
-
fileName: _jsxFileName$2,
|
|
998
|
-
lineNumber: 118
|
|
999
|
-
}
|
|
1000
|
-
})), React$2.createElement(DragAndDropAnswer, {
|
|
1001
|
-
key: index,
|
|
1002
|
-
className: classes.answer,
|
|
1003
|
-
index: index,
|
|
1004
|
-
promptId: id,
|
|
1005
|
-
correct: correctnessMap[id],
|
|
1006
|
-
draggable: !isEmpty$1(sessionAnswer),
|
|
1007
|
-
disabled: disabled,
|
|
1008
|
-
instanceId: instanceId,
|
|
1009
|
-
id: sessionAnswer.id,
|
|
1010
|
-
onPlaceAnswer: (place, id) => onPlaceAnswer(place, id),
|
|
1011
|
-
title: sessionAnswer.title,
|
|
1012
|
-
type: 'target',
|
|
1013
|
-
onRemoveChoice: () => onRemoveAnswer(id),
|
|
1014
|
-
__self: this,
|
|
1015
|
-
__source: {
|
|
1016
|
-
fileName: _jsxFileName$2,
|
|
1017
|
-
lineNumber: 120
|
|
1018
|
-
}
|
|
1019
|
-
}));
|
|
1020
|
-
}));
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
AnswerArea.__initStatic();
|
|
1024
|
-
const styles = () => ({
|
|
1025
|
-
answer: {
|
|
1026
|
-
flex: 1
|
|
1027
|
-
},
|
|
1028
|
-
arrowEntry: {
|
|
1029
|
-
alignItems: 'normal',
|
|
1030
|
-
display: 'flex',
|
|
1031
|
-
height: 40,
|
|
1032
|
-
margin: '10px 20px'
|
|
1033
|
-
},
|
|
1034
|
-
itemList: {
|
|
1035
|
-
alignItems: 'flex-start',
|
|
1036
|
-
display: 'flex',
|
|
1037
|
-
flex: 1,
|
|
1038
|
-
flexDirection: 'column',
|
|
1039
|
-
justifyContent: 'space-between'
|
|
1040
|
-
},
|
|
1041
|
-
promptEntry: {
|
|
1042
|
-
border: '1px solid #c2c2c2',
|
|
1043
|
-
boxSizing: 'border-box',
|
|
1044
|
-
flex: 1,
|
|
1045
|
-
margin: '10px 0',
|
|
1046
|
-
minHeight: 40,
|
|
1047
|
-
overflow: 'hidden',
|
|
1048
|
-
padding: 10,
|
|
1049
|
-
textAlign: 'center',
|
|
1050
|
-
width: '100%',
|
|
1051
|
-
wordBreak: 'break-word'
|
|
1052
|
-
},
|
|
1053
|
-
row: {
|
|
1054
|
-
alignItems: 'center',
|
|
1055
|
-
display: 'flex',
|
|
1056
|
-
justifyContent: 'space-between',
|
|
1057
|
-
width: '100%'
|
|
1058
|
-
}
|
|
1059
|
-
});
|
|
1060
|
-
var AnswerArea$1 = withStyles$2(styles)(AnswerArea);
|
|
1061
|
-
const React$3 = _dll_react;
|
|
1062
|
-
const PropTypes$3 = _dll_prop_types;
|
|
1063
|
-
const {withStyles: withStyles$3} = _dll_material_ui__core_styles;
|
|
1064
|
-
const {isEmpty: isEmpty$2} = _dll_lodash;
|
|
1065
|
-
const {isUndefined: isUndefined$1} = _dll_lodash;
|
|
1066
|
-
const {find: find} = _dll_lodash;
|
|
1067
|
-
const _jsxFileName$3 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/match-list/src/choices-list.jsx";
|
|
1068
|
-
class ChoicesList extends React$3.Component {
|
|
1069
|
-
static __initStatic() {
|
|
1070
|
-
this.propTypes = {
|
|
1071
|
-
classes: PropTypes$3.object,
|
|
1072
|
-
session: PropTypes$3.object.isRequired,
|
|
1073
|
-
instanceId: PropTypes$3.string.isRequired,
|
|
1074
|
-
model: PropTypes$3.object.isRequired,
|
|
1075
|
-
disabled: PropTypes$3.bool.isRequired
|
|
1076
|
-
};
|
|
1077
|
-
}
|
|
1078
|
-
render() {
|
|
1079
|
-
const {model, classes, disabled, session, instanceId} = this.props;
|
|
1080
|
-
const {config} = model;
|
|
1081
|
-
const {duplicates} = config;
|
|
1082
|
-
return React$3.createElement('div', {
|
|
1083
|
-
className: classes.answersContainer,
|
|
1084
|
-
__self: this,
|
|
1085
|
-
__source: {
|
|
1086
|
-
fileName: _jsxFileName$3,
|
|
1087
|
-
lineNumber: 30
|
|
1088
|
-
}
|
|
1089
|
-
}, config.answers.filter(answer => duplicates || isEmpty$2(session) || !session.value || isUndefined$1(find(session.value, val => val === answer.id))).map(answer => React$3.createElement(DragAnswer, {
|
|
1090
|
-
key: answer.id,
|
|
1091
|
-
instanceId: instanceId,
|
|
1092
|
-
className: classes.choice,
|
|
1093
|
-
draggable: true,
|
|
1094
|
-
disabled: disabled,
|
|
1095
|
-
session: session,
|
|
1096
|
-
type: 'choice',
|
|
1097
|
-
...answer,
|
|
1098
|
-
__self: this,
|
|
1099
|
-
__source: {
|
|
1100
|
-
fileName: _jsxFileName$3,
|
|
1101
|
-
lineNumber: 35
|
|
1102
|
-
}
|
|
1103
|
-
})));
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
ChoicesList.__initStatic();
|
|
1107
|
-
const styles$1 = () => ({
|
|
1108
|
-
answersContainer: {
|
|
1109
|
-
alignItems: 'center',
|
|
1110
|
-
display: 'flex',
|
|
1111
|
-
flexDirection: 'row',
|
|
1112
|
-
flexWrap: 'wrap',
|
|
1113
|
-
justifyContent: 'space-between',
|
|
1114
|
-
marginTop: 50
|
|
1115
|
-
},
|
|
1116
|
-
choice: {
|
|
1117
|
-
minHeight: '40px',
|
|
1118
|
-
minWidth: '200px',
|
|
1119
|
-
height: 'initial'
|
|
1120
|
-
}
|
|
1121
|
-
});
|
|
1122
|
-
var ChoicesList$1 = withStyles$3(styles$1)(ChoicesList);
|
|
1123
|
-
const React$4 = _dll_react;
|
|
1124
|
-
const PropTypes$4 = _dll_prop_types;
|
|
1125
|
-
const {withDragContext: withDragContext} = _dll_pie_lib__drag;
|
|
1126
|
-
const {swap: swap} = _dll_pie_lib__drag;
|
|
1127
|
-
const CorrectAnswerToggle = _dll_pie_lib__correct_answer_toggle;
|
|
1128
|
-
const {color: color$1} = _dll_pie_lib__render_ui;
|
|
1129
|
-
const {Feedback: Feedback} = _dll_pie_lib__render_ui;
|
|
1130
|
-
const {withStyles: withStyles$4} = _dll_material_ui__core_styles;
|
|
1131
|
-
const {uniqueId: uniqueId} = _dll_lodash;
|
|
1132
|
-
const {isUndefined: isUndefined$2} = _dll_lodash;
|
|
1133
|
-
const {findKey: findKey} = _dll_lodash;
|
|
1134
|
-
const _jsxFileName$4 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/match-list/src/main.jsx";
|
|
1135
|
-
class Main extends React$4.Component {
|
|
1136
|
-
static __initStatic() {
|
|
1137
|
-
this.propTypes = {
|
|
1138
|
-
classes: PropTypes$4.object,
|
|
1139
|
-
session: PropTypes$4.object.isRequired,
|
|
1140
|
-
onSessionChange: PropTypes$4.func,
|
|
1141
|
-
model: PropTypes$4.object.isRequired,
|
|
1142
|
-
prompt: PropTypes$4.string
|
|
1143
|
-
};
|
|
1144
|
-
}
|
|
1145
|
-
constructor(props) {
|
|
1146
|
-
super(props);
|
|
1147
|
-
Main.prototype.__init.call(this);
|
|
1148
|
-
this.instanceId = uniqueId();
|
|
1149
|
-
this.state = {
|
|
1150
|
-
showCorrectAnswer: false
|
|
1151
|
-
};
|
|
1152
|
-
}
|
|
1153
|
-
onRemoveAnswer(id) {
|
|
1154
|
-
const {session, onSessionChange} = this.props;
|
|
1155
|
-
session.value[id] = undefined;
|
|
1156
|
-
onSessionChange(session);
|
|
1157
|
-
}
|
|
1158
|
-
onPlaceAnswer(place, id) {
|
|
1159
|
-
const {session, onSessionChange, model} = this.props;
|
|
1160
|
-
const {config: {duplicates}} = model;
|
|
1161
|
-
if (isUndefined$2(session.value)) {
|
|
1162
|
-
session.value = {};
|
|
1163
|
-
}
|
|
1164
|
-
const choiceKey = findKey(session.value, val => val === id);
|
|
1165
|
-
if (choiceKey && !duplicates) {
|
|
1166
|
-
session.value = swap(session.value, choiceKey, place);
|
|
1167
|
-
} else {
|
|
1168
|
-
session.value[place] = id;
|
|
1169
|
-
}
|
|
1170
|
-
onSessionChange(session);
|
|
1171
|
-
}
|
|
1172
|
-
__init() {
|
|
1173
|
-
this.toggleShowCorrect = () => {
|
|
1174
|
-
this.setState({
|
|
1175
|
-
showCorrectAnswer: !this.state.showCorrectAnswer
|
|
1176
|
-
});
|
|
1177
|
-
};
|
|
1178
|
-
}
|
|
1179
|
-
render() {
|
|
1180
|
-
const {showCorrectAnswer} = this.state;
|
|
1181
|
-
const {classes, model, session} = this.props;
|
|
1182
|
-
const {config, mode} = model;
|
|
1183
|
-
const {prompt} = config;
|
|
1184
|
-
return React$4.createElement('div', {
|
|
1185
|
-
className: classes.mainContainer,
|
|
1186
|
-
__self: this,
|
|
1187
|
-
__source: {
|
|
1188
|
-
fileName: _jsxFileName$4,
|
|
1189
|
-
lineNumber: 69
|
|
1190
|
-
}
|
|
1191
|
-
}, React$4.createElement(CorrectAnswerToggle, {
|
|
1192
|
-
show: mode === 'evaluate',
|
|
1193
|
-
toggled: showCorrectAnswer,
|
|
1194
|
-
onToggle: this.toggleShowCorrect,
|
|
1195
|
-
__self: this,
|
|
1196
|
-
__source: {
|
|
1197
|
-
fileName: _jsxFileName$4,
|
|
1198
|
-
lineNumber: 70
|
|
1199
|
-
}
|
|
1200
|
-
}), React$4.createElement('div', {
|
|
1201
|
-
className: classes.prompt,
|
|
1202
|
-
dangerouslySetInnerHTML: {
|
|
1203
|
-
__html: prompt
|
|
1204
|
-
},
|
|
1205
|
-
__self: this,
|
|
1206
|
-
__source: {
|
|
1207
|
-
fileName: _jsxFileName$4,
|
|
1208
|
-
lineNumber: 75
|
|
1209
|
-
}
|
|
1210
|
-
}), React$4.createElement(AnswerArea$1, {
|
|
1211
|
-
instanceId: this.instanceId,
|
|
1212
|
-
model: model,
|
|
1213
|
-
session: session,
|
|
1214
|
-
onPlaceAnswer: (place, id) => this.onPlaceAnswer(place, id),
|
|
1215
|
-
onRemoveAnswer: id => this.onRemoveAnswer(id),
|
|
1216
|
-
disabled: mode !== 'gather',
|
|
1217
|
-
showCorrect: showCorrectAnswer,
|
|
1218
|
-
__self: this,
|
|
1219
|
-
__source: {
|
|
1220
|
-
fileName: _jsxFileName$4,
|
|
1221
|
-
lineNumber: 79
|
|
1222
|
-
}
|
|
1223
|
-
}), React$4.createElement(ChoicesList$1, {
|
|
1224
|
-
instanceId: this.instanceId,
|
|
1225
|
-
model: model,
|
|
1226
|
-
session: session,
|
|
1227
|
-
disabled: mode !== 'gather',
|
|
1228
|
-
__self: this,
|
|
1229
|
-
__source: {
|
|
1230
|
-
fileName: _jsxFileName$4,
|
|
1231
|
-
lineNumber: 88
|
|
1232
|
-
}
|
|
1233
|
-
}), model.correctness && model.feedback && !showCorrectAnswer && React$4.createElement(Feedback, {
|
|
1234
|
-
correctness: model.correctness.correctness,
|
|
1235
|
-
feedback: model.feedback,
|
|
1236
|
-
__self: this,
|
|
1237
|
-
__source: {
|
|
1238
|
-
fileName: _jsxFileName$4,
|
|
1239
|
-
lineNumber: 98
|
|
1240
|
-
}
|
|
1241
|
-
}));
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
Main.__initStatic();
|
|
1245
|
-
const styles$2 = theme => ({
|
|
1246
|
-
mainContainer: {
|
|
1247
|
-
display: 'flex',
|
|
1248
|
-
flexDirection: 'column',
|
|
1249
|
-
justifyContent: 'center',
|
|
1250
|
-
color: color$1.text(),
|
|
1251
|
-
backgroundColor: color$1.background(),
|
|
1252
|
-
padding: theme.spacing.unit * 3 / 2
|
|
1253
|
-
},
|
|
1254
|
-
promptList: {
|
|
1255
|
-
alignItems: 'flex-start'
|
|
1256
|
-
},
|
|
1257
|
-
main: {
|
|
1258
|
-
width: '100%'
|
|
1259
|
-
},
|
|
1260
|
-
toggle: {
|
|
1261
|
-
paddingBottom: theme.spacing.unit * 3
|
|
1262
|
-
},
|
|
1263
|
-
prompt: {
|
|
1264
|
-
verticalAlign: 'middle'
|
|
1265
|
-
}
|
|
1266
|
-
});
|
|
1267
|
-
const styledMain = withStyles$4(styles$2)(Main);
|
|
1268
|
-
var Main$1 = withDragContext(styledMain);
|
|
1269
|
-
const React$5 = _dll_react;
|
|
1270
|
-
const ReactDOM = _dll_react_dom;
|
|
1271
|
-
const {SessionChangedEvent: SessionChangedEvent} = _dll_pie_framework__pie_player_events;
|
|
1272
|
-
const {renderMath: renderMath} = _dll_pie_lib__math_rendering;
|
|
1273
|
-
const log$1 = browser('pie-ui:graph-lines');
|
|
1274
|
-
const isComplete = (session, model) => {
|
|
1275
|
-
if (!session) {
|
|
1276
|
-
return false;
|
|
1277
|
-
}
|
|
1278
|
-
const value = session.value;
|
|
1279
|
-
let complete = true;
|
|
1280
|
-
if (value) {
|
|
1281
|
-
(model.config.prompts || []).forEach(prompt => {
|
|
1282
|
-
if (!Number.isFinite(value[prompt.id])) {
|
|
1283
|
-
complete = false;
|
|
1284
|
-
}
|
|
1285
|
-
});
|
|
1286
|
-
}
|
|
1287
|
-
return complete;
|
|
1288
|
-
};
|
|
1289
|
-
class MatchList extends HTMLElement {
|
|
1290
|
-
constructor() {
|
|
1291
|
-
super();
|
|
1292
|
-
}
|
|
1293
|
-
set model(m) {
|
|
1294
|
-
this._model = m;
|
|
1295
|
-
this._render();
|
|
1296
|
-
}
|
|
1297
|
-
set session(s) {
|
|
1298
|
-
this._session = s;
|
|
1299
|
-
this._render();
|
|
1300
|
-
}
|
|
1301
|
-
sessionChanged(s) {
|
|
1302
|
-
this._session.value = s.value;
|
|
1303
|
-
this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(this._session, this._model)));
|
|
1304
|
-
log$1('session: ', this._session);
|
|
1305
|
-
this._render();
|
|
1306
|
-
}
|
|
1307
|
-
connectedCallback() {
|
|
1308
|
-
this._render();
|
|
1309
|
-
}
|
|
1310
|
-
_render() {
|
|
1311
|
-
if (!this._model || !this._session) {
|
|
1312
|
-
return;
|
|
1313
|
-
}
|
|
1314
|
-
const el = React$5.createElement(Main$1, {
|
|
1315
|
-
model: this._model,
|
|
1316
|
-
session: this._session,
|
|
1317
|
-
onSessionChange: this.sessionChanged.bind(this)
|
|
1318
|
-
});
|
|
1319
|
-
ReactDOM.render(el, this, () => {
|
|
1320
|
-
renderMath(this);
|
|
1321
|
-
});
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
export default MatchList;
|
|
1325
|
-
export {Main$1 as Component, isComplete};
|