@pie-element/categorize 6.7.2 → 6.7.3-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 +160 -0
- package/configure/CHANGELOG.md +117 -0
- package/configure/lib/defaults.js +11 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/design/builder.js +1 -1
- package/configure/lib/design/buttons.js +6 -4
- package/configure/lib/design/buttons.js.map +1 -1
- package/configure/lib/design/categories/alternateResponses.js +4 -2
- package/configure/lib/design/categories/alternateResponses.js.map +1 -1
- package/configure/lib/design/categories/category.js +9 -4
- package/configure/lib/design/categories/category.js.map +1 -1
- package/configure/lib/design/categories/choice-preview.js +4 -4
- package/configure/lib/design/categories/choice-preview.js.map +1 -1
- package/configure/lib/design/categories/droppable-placeholder.js +3 -3
- package/configure/lib/design/categories/droppable-placeholder.js.map +1 -1
- package/configure/lib/design/categories/index.js +69 -10
- package/configure/lib/design/categories/index.js.map +1 -1
- package/configure/lib/design/choices/choice.js +21 -6
- package/configure/lib/design/choices/choice.js.map +1 -1
- package/configure/lib/design/choices/config.js +5 -3
- package/configure/lib/design/choices/config.js.map +1 -1
- package/configure/lib/design/choices/index.js +34 -8
- package/configure/lib/design/choices/index.js.map +1 -1
- package/configure/lib/design/header.js +15 -5
- package/configure/lib/design/header.js.map +1 -1
- package/configure/lib/design/index.js +41 -11
- package/configure/lib/design/index.js.map +1 -1
- package/configure/lib/design/input-header.js +12 -4
- package/configure/lib/design/input-header.js.map +1 -1
- package/configure/lib/index.js +3 -3
- package/configure/lib/main.js +1 -1
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/utils.js +20 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +16 -0
- package/controller/lib/index.js +83 -3
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +31 -0
- package/docs/config-schema.json.md +24 -0
- package/docs/demo/generate.js +1 -0
- package/docs/pie-schema.json +16 -0
- package/docs/pie-schema.json.md +15 -0
- package/lib/categorize/categories.js +9 -4
- package/lib/categorize/categories.js.map +1 -1
- package/lib/categorize/category.js +4 -4
- package/lib/categorize/category.js.map +1 -1
- package/lib/categorize/choice.js +5 -4
- package/lib/categorize/choice.js.map +1 -1
- package/lib/categorize/choices.js +12 -5
- package/lib/categorize/choices.js.map +1 -1
- package/lib/categorize/droppable-placeholder.js +2 -2
- package/lib/categorize/droppable-placeholder.js.map +1 -1
- package/lib/categorize/grid-content.js +3 -3
- package/lib/categorize/grid-content.js.map +1 -1
- package/lib/categorize/index.js +11 -15
- package/lib/categorize/index.js.map +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/package.json +5 -5
- package/docs/demo/.pie/.configure/package.json +0 -10
- package/docs/demo/.pie/.configure/yarn.lock +0 -1128
- package/docs/demo/.pie/.controllers/package.json +0 -10
- package/docs/demo/.pie/.controllers/yarn.lock +0 -43
- package/docs/demo/.pie/info.entry.js +0 -89
- package/docs/demo/.pie/info.webpack.config.js +0 -108
- package/docs/demo/.pie/package.json +0 -10
- package/docs/demo/.pie/yarn.lock +0 -579
- package/module/configure.js +0 -3155
- package/module/controller.js +0 -19950
- package/module/demo.js +0 -118
- package/module/element.js +0 -1470
- package/module/index.html +0 -16
- package/module/manifest.json +0 -10
package/module/element.js
DELETED
|
@@ -1,1470 +0,0 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_react_dnd, _dll_pie_lib__drag, _dll_material_ui__core, _dll_pie_lib__render_ui, _dll_lodash, _dll_pie_lib__correct_answer_toggle, _dll_react_dom, _dll_pie_lib__math_rendering, _dll_pie_framework__pie_player_events} from "../../../@pie-ui/shared-lib@^4.3.3/module/index.js";
|
|
2
|
-
function createCommonjsModule(fn, module) {
|
|
3
|
-
return (module = {
|
|
4
|
-
exports: {}
|
|
5
|
-
}, fn(module, module.exports), module.exports);
|
|
6
|
-
}
|
|
7
|
-
var classnames = createCommonjsModule(function (module) {
|
|
8
|
-
(function () {
|
|
9
|
-
var hasOwn = ({}).hasOwnProperty;
|
|
10
|
-
function classNames() {
|
|
11
|
-
var classes = [];
|
|
12
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
13
|
-
var arg = arguments[i];
|
|
14
|
-
if (!arg) continue;
|
|
15
|
-
var argType = typeof arg;
|
|
16
|
-
if (argType === 'string' || argType === 'number') {
|
|
17
|
-
classes.push(arg);
|
|
18
|
-
} else if (Array.isArray(arg) && arg.length) {
|
|
19
|
-
var inner = classNames.apply(null, arg);
|
|
20
|
-
if (inner) {
|
|
21
|
-
classes.push(inner);
|
|
22
|
-
}
|
|
23
|
-
} else if (argType === 'object') {
|
|
24
|
-
for (var key in arg) {
|
|
25
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
26
|
-
classes.push(key);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return classes.join(' ');
|
|
32
|
-
}
|
|
33
|
-
if (module.exports) {
|
|
34
|
-
classNames.default = classNames;
|
|
35
|
-
module.exports = classNames;
|
|
36
|
-
} else {
|
|
37
|
-
window.classNames = classNames;
|
|
38
|
-
}
|
|
39
|
-
})();
|
|
40
|
-
});
|
|
41
|
-
var s = 1000;
|
|
42
|
-
var m = s * 60;
|
|
43
|
-
var h = m * 60;
|
|
44
|
-
var d = h * 24;
|
|
45
|
-
var w = d * 7;
|
|
46
|
-
var y = d * 365.25;
|
|
47
|
-
var ms = function (val, options) {
|
|
48
|
-
options = options || ({});
|
|
49
|
-
var type = typeof val;
|
|
50
|
-
if (type === 'string' && val.length > 0) {
|
|
51
|
-
return parse(val);
|
|
52
|
-
} else if (type === 'number' && isFinite(val)) {
|
|
53
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
54
|
-
}
|
|
55
|
-
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
|
|
56
|
-
};
|
|
57
|
-
function parse(str) {
|
|
58
|
-
str = String(str);
|
|
59
|
-
if (str.length > 100) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
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);
|
|
63
|
-
if (!match) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
var n = parseFloat(match[1]);
|
|
67
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
68
|
-
switch (type) {
|
|
69
|
-
case 'years':
|
|
70
|
-
case 'year':
|
|
71
|
-
case 'yrs':
|
|
72
|
-
case 'yr':
|
|
73
|
-
case 'y':
|
|
74
|
-
return n * y;
|
|
75
|
-
case 'weeks':
|
|
76
|
-
case 'week':
|
|
77
|
-
case 'w':
|
|
78
|
-
return n * w;
|
|
79
|
-
case 'days':
|
|
80
|
-
case 'day':
|
|
81
|
-
case 'd':
|
|
82
|
-
return n * d;
|
|
83
|
-
case 'hours':
|
|
84
|
-
case 'hour':
|
|
85
|
-
case 'hrs':
|
|
86
|
-
case 'hr':
|
|
87
|
-
case 'h':
|
|
88
|
-
return n * h;
|
|
89
|
-
case 'minutes':
|
|
90
|
-
case 'minute':
|
|
91
|
-
case 'mins':
|
|
92
|
-
case 'min':
|
|
93
|
-
case 'm':
|
|
94
|
-
return n * m;
|
|
95
|
-
case 'seconds':
|
|
96
|
-
case 'second':
|
|
97
|
-
case 'secs':
|
|
98
|
-
case 'sec':
|
|
99
|
-
case 's':
|
|
100
|
-
return n * s;
|
|
101
|
-
case 'milliseconds':
|
|
102
|
-
case 'millisecond':
|
|
103
|
-
case 'msecs':
|
|
104
|
-
case 'msec':
|
|
105
|
-
case 'ms':
|
|
106
|
-
return n;
|
|
107
|
-
default:
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
function fmtShort(ms) {
|
|
112
|
-
var msAbs = Math.abs(ms);
|
|
113
|
-
if (msAbs >= d) {
|
|
114
|
-
return Math.round(ms / d) + 'd';
|
|
115
|
-
}
|
|
116
|
-
if (msAbs >= h) {
|
|
117
|
-
return Math.round(ms / h) + 'h';
|
|
118
|
-
}
|
|
119
|
-
if (msAbs >= m) {
|
|
120
|
-
return Math.round(ms / m) + 'm';
|
|
121
|
-
}
|
|
122
|
-
if (msAbs >= s) {
|
|
123
|
-
return Math.round(ms / s) + 's';
|
|
124
|
-
}
|
|
125
|
-
return ms + 'ms';
|
|
126
|
-
}
|
|
127
|
-
function fmtLong(ms) {
|
|
128
|
-
var msAbs = Math.abs(ms);
|
|
129
|
-
if (msAbs >= d) {
|
|
130
|
-
return plural(ms, msAbs, d, 'day');
|
|
131
|
-
}
|
|
132
|
-
if (msAbs >= h) {
|
|
133
|
-
return plural(ms, msAbs, h, 'hour');
|
|
134
|
-
}
|
|
135
|
-
if (msAbs >= m) {
|
|
136
|
-
return plural(ms, msAbs, m, 'minute');
|
|
137
|
-
}
|
|
138
|
-
if (msAbs >= s) {
|
|
139
|
-
return plural(ms, msAbs, s, 'second');
|
|
140
|
-
}
|
|
141
|
-
return ms + ' ms';
|
|
142
|
-
}
|
|
143
|
-
function plural(ms, msAbs, n, name) {
|
|
144
|
-
var isPlural = msAbs >= n * 1.5;
|
|
145
|
-
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
146
|
-
}
|
|
147
|
-
function setup(env) {
|
|
148
|
-
createDebug.debug = createDebug;
|
|
149
|
-
createDebug.default = createDebug;
|
|
150
|
-
createDebug.coerce = coerce;
|
|
151
|
-
createDebug.disable = disable;
|
|
152
|
-
createDebug.enable = enable;
|
|
153
|
-
createDebug.enabled = enabled;
|
|
154
|
-
createDebug.humanize = ms;
|
|
155
|
-
createDebug.destroy = destroy;
|
|
156
|
-
Object.keys(env).forEach(key => {
|
|
157
|
-
createDebug[key] = env[key];
|
|
158
|
-
});
|
|
159
|
-
createDebug.names = [];
|
|
160
|
-
createDebug.skips = [];
|
|
161
|
-
createDebug.formatters = {};
|
|
162
|
-
function selectColor(namespace) {
|
|
163
|
-
let hash = 0;
|
|
164
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
165
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
166
|
-
hash |= 0;
|
|
167
|
-
}
|
|
168
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
169
|
-
}
|
|
170
|
-
createDebug.selectColor = selectColor;
|
|
171
|
-
function createDebug(namespace) {
|
|
172
|
-
let prevTime;
|
|
173
|
-
let enableOverride = null;
|
|
174
|
-
function debug(...args) {
|
|
175
|
-
if (!debug.enabled) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
const self = debug;
|
|
179
|
-
const curr = Number(new Date());
|
|
180
|
-
const ms = curr - (prevTime || curr);
|
|
181
|
-
self.diff = ms;
|
|
182
|
-
self.prev = prevTime;
|
|
183
|
-
self.curr = curr;
|
|
184
|
-
prevTime = curr;
|
|
185
|
-
args[0] = createDebug.coerce(args[0]);
|
|
186
|
-
if (typeof args[0] !== 'string') {
|
|
187
|
-
args.unshift('%O');
|
|
188
|
-
}
|
|
189
|
-
let index = 0;
|
|
190
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
191
|
-
if (match === '%%') {
|
|
192
|
-
return '%';
|
|
193
|
-
}
|
|
194
|
-
index++;
|
|
195
|
-
const formatter = createDebug.formatters[format];
|
|
196
|
-
if (typeof formatter === 'function') {
|
|
197
|
-
const val = args[index];
|
|
198
|
-
match = formatter.call(self, val);
|
|
199
|
-
args.splice(index, 1);
|
|
200
|
-
index--;
|
|
201
|
-
}
|
|
202
|
-
return match;
|
|
203
|
-
});
|
|
204
|
-
createDebug.formatArgs.call(self, args);
|
|
205
|
-
const logFn = self.log || createDebug.log;
|
|
206
|
-
logFn.apply(self, args);
|
|
207
|
-
}
|
|
208
|
-
debug.namespace = namespace;
|
|
209
|
-
debug.useColors = createDebug.useColors();
|
|
210
|
-
debug.color = createDebug.selectColor(namespace);
|
|
211
|
-
debug.extend = extend;
|
|
212
|
-
debug.destroy = createDebug.destroy;
|
|
213
|
-
Object.defineProperty(debug, 'enabled', {
|
|
214
|
-
enumerable: true,
|
|
215
|
-
configurable: false,
|
|
216
|
-
get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
|
|
217
|
-
set: v => {
|
|
218
|
-
enableOverride = v;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
if (typeof createDebug.init === 'function') {
|
|
222
|
-
createDebug.init(debug);
|
|
223
|
-
}
|
|
224
|
-
return debug;
|
|
225
|
-
}
|
|
226
|
-
function extend(namespace, delimiter) {
|
|
227
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
228
|
-
newDebug.log = this.log;
|
|
229
|
-
return newDebug;
|
|
230
|
-
}
|
|
231
|
-
function enable(namespaces) {
|
|
232
|
-
createDebug.save(namespaces);
|
|
233
|
-
createDebug.names = [];
|
|
234
|
-
createDebug.skips = [];
|
|
235
|
-
let i;
|
|
236
|
-
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
237
|
-
const len = split.length;
|
|
238
|
-
for (i = 0; i < len; i++) {
|
|
239
|
-
if (!split[i]) {
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
|
243
|
-
if (namespaces[0] === '-') {
|
|
244
|
-
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|
245
|
-
} else {
|
|
246
|
-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function disable() {
|
|
251
|
-
const namespaces = [...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)].join(',');
|
|
252
|
-
createDebug.enable('');
|
|
253
|
-
return namespaces;
|
|
254
|
-
}
|
|
255
|
-
function enabled(name) {
|
|
256
|
-
if (name[name.length - 1] === '*') {
|
|
257
|
-
return true;
|
|
258
|
-
}
|
|
259
|
-
let i;
|
|
260
|
-
let len;
|
|
261
|
-
for ((i = 0, len = createDebug.skips.length); i < len; i++) {
|
|
262
|
-
if (createDebug.skips[i].test(name)) {
|
|
263
|
-
return false;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
for ((i = 0, len = createDebug.names.length); i < len; i++) {
|
|
267
|
-
if (createDebug.names[i].test(name)) {
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
273
|
-
function toNamespace(regexp) {
|
|
274
|
-
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
|
|
275
|
-
}
|
|
276
|
-
function coerce(val) {
|
|
277
|
-
if (val instanceof Error) {
|
|
278
|
-
return val.stack || val.message;
|
|
279
|
-
}
|
|
280
|
-
return val;
|
|
281
|
-
}
|
|
282
|
-
function destroy() {
|
|
283
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
284
|
-
}
|
|
285
|
-
createDebug.enable(createDebug.load());
|
|
286
|
-
return createDebug;
|
|
287
|
-
}
|
|
288
|
-
var common = setup;
|
|
289
|
-
var browser = createCommonjsModule(function (module, exports) {
|
|
290
|
-
exports.formatArgs = formatArgs;
|
|
291
|
-
exports.save = save;
|
|
292
|
-
exports.load = load;
|
|
293
|
-
exports.useColors = useColors;
|
|
294
|
-
exports.storage = localstorage();
|
|
295
|
-
exports.destroy = (() => {
|
|
296
|
-
let warned = false;
|
|
297
|
-
return () => {
|
|
298
|
-
if (!warned) {
|
|
299
|
-
warned = true;
|
|
300
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
})();
|
|
304
|
-
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'];
|
|
305
|
-
function useColors() {
|
|
306
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
307
|
-
return true;
|
|
308
|
-
}
|
|
309
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
310
|
-
return false;
|
|
311
|
-
}
|
|
312
|
-
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+)/);
|
|
313
|
-
}
|
|
314
|
-
function formatArgs(args) {
|
|
315
|
-
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
|
316
|
-
if (!this.useColors) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
const c = 'color: ' + this.color;
|
|
320
|
-
args.splice(1, 0, c, 'color: inherit');
|
|
321
|
-
let index = 0;
|
|
322
|
-
let lastC = 0;
|
|
323
|
-
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
324
|
-
if (match === '%%') {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
index++;
|
|
328
|
-
if (match === '%c') {
|
|
329
|
-
lastC = index;
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
args.splice(lastC, 0, c);
|
|
333
|
-
}
|
|
334
|
-
exports.log = console.debug || console.log || (() => {});
|
|
335
|
-
function save(namespaces) {
|
|
336
|
-
try {
|
|
337
|
-
if (namespaces) {
|
|
338
|
-
exports.storage.setItem('debug', namespaces);
|
|
339
|
-
} else {
|
|
340
|
-
exports.storage.removeItem('debug');
|
|
341
|
-
}
|
|
342
|
-
} catch (error) {}
|
|
343
|
-
}
|
|
344
|
-
function load() {
|
|
345
|
-
let r;
|
|
346
|
-
try {
|
|
347
|
-
r = exports.storage.getItem('debug');
|
|
348
|
-
} catch (error) {}
|
|
349
|
-
if (!r && typeof process !== 'undefined' && ('env' in process)) {
|
|
350
|
-
r = process.env.DEBUG;
|
|
351
|
-
}
|
|
352
|
-
return r;
|
|
353
|
-
}
|
|
354
|
-
function localstorage() {
|
|
355
|
-
try {
|
|
356
|
-
return localStorage;
|
|
357
|
-
} catch (error) {}
|
|
358
|
-
}
|
|
359
|
-
module.exports = common(exports);
|
|
360
|
-
const {formatters} = module.exports;
|
|
361
|
-
formatters.j = function (v) {
|
|
362
|
-
try {
|
|
363
|
-
return JSON.stringify(v);
|
|
364
|
-
} catch (error) {
|
|
365
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
});
|
|
369
|
-
browser.formatArgs;
|
|
370
|
-
browser.save;
|
|
371
|
-
browser.load;
|
|
372
|
-
browser.useColors;
|
|
373
|
-
browser.storage;
|
|
374
|
-
browser.destroy;
|
|
375
|
-
browser.colors;
|
|
376
|
-
browser.log;
|
|
377
|
-
const React = _dll_react;
|
|
378
|
-
const PropTypes = _dll_prop_types;
|
|
379
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
380
|
-
const {DragSource: DragSource} = _dll_react_dnd;
|
|
381
|
-
const {uid: uid} = _dll_pie_lib__drag;
|
|
382
|
-
const {Card: Card} = _dll_material_ui__core;
|
|
383
|
-
const {CardContent: CardContent} = _dll_material_ui__core;
|
|
384
|
-
const {color: color} = _dll_pie_lib__render_ui;
|
|
385
|
-
const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/categorize/src/categorize/choice.jsx";
|
|
386
|
-
const log = browser('@pie-ui:categorize:choice');
|
|
387
|
-
const ChoiceType = {
|
|
388
|
-
content: PropTypes.string.isRequired,
|
|
389
|
-
id: PropTypes.string
|
|
390
|
-
};
|
|
391
|
-
class Layout extends React.Component {
|
|
392
|
-
static __initStatic() {
|
|
393
|
-
this.propTypes = {
|
|
394
|
-
...ChoiceType,
|
|
395
|
-
classes: PropTypes.object.isRequired,
|
|
396
|
-
className: PropTypes.string,
|
|
397
|
-
disabled: PropTypes.bool,
|
|
398
|
-
correct: PropTypes.bool
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
static __initStatic2() {
|
|
402
|
-
this.defaultProps = {};
|
|
403
|
-
}
|
|
404
|
-
render() {
|
|
405
|
-
const {classes, className, content, isDragging, disabled, correct} = this.props;
|
|
406
|
-
const rootNames = classnames(correct === true && 'correct', correct === false && 'incorrect', classes.choice, isDragging && classes.dragging, disabled && classes.disabled, className);
|
|
407
|
-
const cardNames = classnames(classes.card);
|
|
408
|
-
return React.createElement('div', {
|
|
409
|
-
className: rootNames,
|
|
410
|
-
__self: this,
|
|
411
|
-
__source: {
|
|
412
|
-
fileName: _jsxFileName,
|
|
413
|
-
lineNumber: 48
|
|
414
|
-
}
|
|
415
|
-
}, React.createElement(Card, {
|
|
416
|
-
className: cardNames,
|
|
417
|
-
__self: this,
|
|
418
|
-
__source: {
|
|
419
|
-
fileName: _jsxFileName,
|
|
420
|
-
lineNumber: 49
|
|
421
|
-
}
|
|
422
|
-
}, React.createElement(CardContent, {
|
|
423
|
-
classes: {
|
|
424
|
-
root: classes.cardRoot
|
|
425
|
-
},
|
|
426
|
-
dangerouslySetInnerHTML: {
|
|
427
|
-
__html: content
|
|
428
|
-
},
|
|
429
|
-
__self: this,
|
|
430
|
-
__source: {
|
|
431
|
-
fileName: _jsxFileName,
|
|
432
|
-
lineNumber: 50
|
|
433
|
-
}
|
|
434
|
-
})));
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
Layout.__initStatic();
|
|
438
|
-
Layout.__initStatic2();
|
|
439
|
-
const styles = () => ({
|
|
440
|
-
choice: {
|
|
441
|
-
cursor: 'pointer',
|
|
442
|
-
height: '100%',
|
|
443
|
-
width: '100%',
|
|
444
|
-
'&.correct': {
|
|
445
|
-
border: `solid 2px ${color.correct()}`
|
|
446
|
-
},
|
|
447
|
-
'&.incorrect': {
|
|
448
|
-
border: `solid 2px ${color.incorrect()}`
|
|
449
|
-
}
|
|
450
|
-
},
|
|
451
|
-
cardRoot: {
|
|
452
|
-
color: color.text(),
|
|
453
|
-
backgroundColor: color.background(),
|
|
454
|
-
border: '1px solid'
|
|
455
|
-
},
|
|
456
|
-
disabled: {
|
|
457
|
-
cursor: 'not-allowed',
|
|
458
|
-
opacity: '0.6'
|
|
459
|
-
},
|
|
460
|
-
dragging: {
|
|
461
|
-
cursor: 'move'
|
|
462
|
-
},
|
|
463
|
-
card: {
|
|
464
|
-
color: color.text(),
|
|
465
|
-
backgroundColor: color.background(),
|
|
466
|
-
width: '100%'
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
const Styled = withStyles(styles)(Layout);
|
|
470
|
-
class Choice extends React.Component {
|
|
471
|
-
static __initStatic3() {
|
|
472
|
-
this.propTypes = {
|
|
473
|
-
...ChoiceType,
|
|
474
|
-
connectDragSource: PropTypes.func.isRequired
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
render() {
|
|
478
|
-
const {connectDragSource, id, content, disabled, isDragging, correct} = this.props;
|
|
479
|
-
return connectDragSource(React.createElement('div', {
|
|
480
|
-
style: {
|
|
481
|
-
width: '100%',
|
|
482
|
-
height: 'max-content'
|
|
483
|
-
},
|
|
484
|
-
__self: this,
|
|
485
|
-
__source: {
|
|
486
|
-
fileName: _jsxFileName,
|
|
487
|
-
lineNumber: 106
|
|
488
|
-
}
|
|
489
|
-
}, React.createElement(Styled, {
|
|
490
|
-
id: id,
|
|
491
|
-
content: content,
|
|
492
|
-
disabled: disabled,
|
|
493
|
-
correct: correct,
|
|
494
|
-
isDragging: isDragging,
|
|
495
|
-
__self: this,
|
|
496
|
-
__source: {
|
|
497
|
-
fileName: _jsxFileName,
|
|
498
|
-
lineNumber: 107
|
|
499
|
-
}
|
|
500
|
-
})));
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
Choice.__initStatic3();
|
|
504
|
-
const spec = {
|
|
505
|
-
canDrag: props => !props.disabled,
|
|
506
|
-
beginDrag: props => {
|
|
507
|
-
const out = {
|
|
508
|
-
id: props.id,
|
|
509
|
-
categoryId: props.categoryId,
|
|
510
|
-
choiceIndex: props.choiceIndex
|
|
511
|
-
};
|
|
512
|
-
log('[beginDrag] out:', out);
|
|
513
|
-
return out;
|
|
514
|
-
},
|
|
515
|
-
endDrag: (props, monitor) => {
|
|
516
|
-
if (!monitor.didDrop()) {
|
|
517
|
-
const item = monitor.getItem();
|
|
518
|
-
if (item.categoryId) {
|
|
519
|
-
log('wasnt droppped - what to do?');
|
|
520
|
-
props.onRemoveChoice(item);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
const DraggableChoice = DragSource(({uid}) => uid, spec, (connect, monitor) => ({
|
|
526
|
-
connectDragSource: connect.dragSource(),
|
|
527
|
-
isDragging: monitor.isDragging()
|
|
528
|
-
}))(Choice);
|
|
529
|
-
var Choice$1 = uid.withUid(DraggableChoice);
|
|
530
|
-
const React$1 = _dll_react;
|
|
531
|
-
const PropTypes$1 = _dll_prop_types;
|
|
532
|
-
const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
|
|
533
|
-
const _jsxFileName$1 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/categorize/src/categorize/grid-content.jsx";
|
|
534
|
-
class GridContent extends React$1.Component {
|
|
535
|
-
static __initStatic() {
|
|
536
|
-
this.propTypes = {
|
|
537
|
-
classes: PropTypes$1.object.isRequired,
|
|
538
|
-
className: PropTypes$1.string,
|
|
539
|
-
children: PropTypes$1.oneOfType([PropTypes$1.arrayOf(PropTypes$1.node), PropTypes$1.node]).isRequired,
|
|
540
|
-
columns: PropTypes$1.number,
|
|
541
|
-
rows: PropTypes$1.number,
|
|
542
|
-
extraStyle: PropTypes$1.object
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
static __initStatic2() {
|
|
546
|
-
this.defaultProps = {
|
|
547
|
-
columns: 2,
|
|
548
|
-
rows: 2
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
render() {
|
|
552
|
-
const {classes, className, children, columns, extraStyle, rows} = this.props;
|
|
553
|
-
const style = {
|
|
554
|
-
gridTemplateColumns: `repeat(${columns}, 1fr)`,
|
|
555
|
-
gridTemplateRows: `repeat(${rows}, auto)`,
|
|
556
|
-
...extraStyle
|
|
557
|
-
};
|
|
558
|
-
return React$1.createElement('div', {
|
|
559
|
-
style: style,
|
|
560
|
-
className: classnames(classes.gridContent, className),
|
|
561
|
-
__self: this,
|
|
562
|
-
__source: {
|
|
563
|
-
fileName: _jsxFileName$1,
|
|
564
|
-
lineNumber: 32
|
|
565
|
-
}
|
|
566
|
-
}, children);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
GridContent.__initStatic();
|
|
570
|
-
GridContent.__initStatic2();
|
|
571
|
-
const styles$1 = theme => ({
|
|
572
|
-
gridContent: {
|
|
573
|
-
display: 'grid',
|
|
574
|
-
columnGap: `${theme.spacing.unit}px`,
|
|
575
|
-
gridColumnGap: `${theme.spacing.unit}px`,
|
|
576
|
-
rowGap: `${theme.spacing.unit}px`,
|
|
577
|
-
gridRowGap: `${theme.spacing.unit}px`,
|
|
578
|
-
gridAutoRows: '1fr'
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
var GridContent$1 = withStyles$1(styles$1)(GridContent);
|
|
582
|
-
const React$2 = _dll_react;
|
|
583
|
-
const PropTypes$2 = _dll_prop_types;
|
|
584
|
-
const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
|
|
585
|
-
const _jsxFileName$2 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/categorize/src/categorize/choices.jsx";
|
|
586
|
-
const Blank = () => React$2.createElement('div', {
|
|
587
|
-
__self: undefined,
|
|
588
|
-
__source: {
|
|
589
|
-
fileName: _jsxFileName$2,
|
|
590
|
-
lineNumber: 8
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
class Choices extends React$2.Component {
|
|
594
|
-
static __initStatic() {
|
|
595
|
-
this.propTypes = {
|
|
596
|
-
classes: PropTypes$2.object.isRequired,
|
|
597
|
-
choices: PropTypes$2.arrayOf(PropTypes$2.oneOfType([PropTypes$2.shape(ChoiceType), PropTypes$2.shape({
|
|
598
|
-
empty: PropTypes$2.bool
|
|
599
|
-
})])),
|
|
600
|
-
model: PropTypes$2.shape({
|
|
601
|
-
choicesPerRow: PropTypes$2.number,
|
|
602
|
-
choicesLabel: PropTypes$2.string
|
|
603
|
-
}),
|
|
604
|
-
disabled: PropTypes$2.bool,
|
|
605
|
-
choicePosition: PropTypes$2.string
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
static __initStatic2() {
|
|
609
|
-
this.defaultProps = {
|
|
610
|
-
model: {
|
|
611
|
-
choicesPerRow: 4,
|
|
612
|
-
choicesLabel: ''
|
|
613
|
-
}
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
render() {
|
|
617
|
-
const {classes, choices = [], model, disabled, choicePosition} = this.props;
|
|
618
|
-
let style = {
|
|
619
|
-
textAlign: 'center'
|
|
620
|
-
};
|
|
621
|
-
if (choicePosition === 'left') {
|
|
622
|
-
style.direction = 'rtl';
|
|
623
|
-
}
|
|
624
|
-
return React$2.createElement('div', {
|
|
625
|
-
className: classes.wrapper,
|
|
626
|
-
__self: this,
|
|
627
|
-
__source: {
|
|
628
|
-
fileName: _jsxFileName$2,
|
|
629
|
-
lineNumber: 51
|
|
630
|
-
}
|
|
631
|
-
}, model.choicesLabel && model.choicesLabel !== '' && React$2.createElement('div', {
|
|
632
|
-
className: classes.labelHolder,
|
|
633
|
-
__self: this,
|
|
634
|
-
__source: {
|
|
635
|
-
fileName: _jsxFileName$2,
|
|
636
|
-
lineNumber: 53
|
|
637
|
-
}
|
|
638
|
-
}, model.choicesLabel), React$2.createElement(GridContent$1, {
|
|
639
|
-
columns: model.choicesPerRow,
|
|
640
|
-
className: classes.choices,
|
|
641
|
-
extraStyle: style,
|
|
642
|
-
__self: this,
|
|
643
|
-
__source: {
|
|
644
|
-
fileName: _jsxFileName$2,
|
|
645
|
-
lineNumber: 55
|
|
646
|
-
}
|
|
647
|
-
}, choices.map((c, index) => {
|
|
648
|
-
return c.empty ? React$2.createElement(Blank, {
|
|
649
|
-
key: index,
|
|
650
|
-
__self: this,
|
|
651
|
-
__source: {
|
|
652
|
-
fileName: _jsxFileName$2,
|
|
653
|
-
lineNumber: 62
|
|
654
|
-
}
|
|
655
|
-
}) : React$2.createElement(Choice$1, {
|
|
656
|
-
disabled: disabled,
|
|
657
|
-
className: classes.choice,
|
|
658
|
-
key: index,
|
|
659
|
-
...c,
|
|
660
|
-
__self: this,
|
|
661
|
-
__source: {
|
|
662
|
-
fileName: _jsxFileName$2,
|
|
663
|
-
lineNumber: 64
|
|
664
|
-
}
|
|
665
|
-
});
|
|
666
|
-
})));
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
Choices.__initStatic();
|
|
670
|
-
Choices.__initStatic2();
|
|
671
|
-
const styles$2 = theme => ({
|
|
672
|
-
wrapper: {
|
|
673
|
-
flex: 1,
|
|
674
|
-
padding: theme.spacing.unit
|
|
675
|
-
},
|
|
676
|
-
choices: {
|
|
677
|
-
paddingTop: theme.spacing.unit,
|
|
678
|
-
paddingBottom: theme.spacing.unit
|
|
679
|
-
},
|
|
680
|
-
labelHolder: {
|
|
681
|
-
margin: '0 auto',
|
|
682
|
-
textAlign: 'center',
|
|
683
|
-
paddingTop: theme.spacing.unit
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
var Choices$1 = withStyles$2(styles$2)(Choices);
|
|
687
|
-
const React$3 = _dll_react;
|
|
688
|
-
const {PlaceHolder: PlaceHolder} = _dll_pie_lib__drag;
|
|
689
|
-
const {uid: uid$1} = _dll_pie_lib__drag;
|
|
690
|
-
const PropTypes$3 = _dll_prop_types;
|
|
691
|
-
const {DropTarget: DropTarget} = _dll_react_dnd;
|
|
692
|
-
const _jsxFileName$3 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/categorize/src/categorize/droppable-placeholder.jsx";
|
|
693
|
-
const log$1 = browser('@pie-ui:categorize:droppable-placeholder');
|
|
694
|
-
class DroppablePlaceholder extends React$3.Component {
|
|
695
|
-
static __initStatic() {
|
|
696
|
-
this.propTypes = {
|
|
697
|
-
connectDropTarget: PropTypes$3.func.isRequired,
|
|
698
|
-
isOver: PropTypes$3.bool,
|
|
699
|
-
children: PropTypes$3.oneOfType([PropTypes$3.arrayOf(PropTypes$3.node), PropTypes$3.node]).isRequired,
|
|
700
|
-
className: PropTypes$3.string,
|
|
701
|
-
grid: PropTypes$3.object,
|
|
702
|
-
disabled: PropTypes$3.bool
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
render() {
|
|
706
|
-
const {children, connectDropTarget, isOver, className, grid, disabled} = this.props;
|
|
707
|
-
return connectDropTarget(React$3.createElement('div', {
|
|
708
|
-
style: {
|
|
709
|
-
flex: 1
|
|
710
|
-
},
|
|
711
|
-
__self: this,
|
|
712
|
-
__source: {
|
|
713
|
-
fileName: _jsxFileName$3,
|
|
714
|
-
lineNumber: 33
|
|
715
|
-
}
|
|
716
|
-
}, React$3.createElement(PlaceHolder, {
|
|
717
|
-
className: className,
|
|
718
|
-
isOver: isOver,
|
|
719
|
-
grid: grid,
|
|
720
|
-
disabled: disabled,
|
|
721
|
-
__self: this,
|
|
722
|
-
__source: {
|
|
723
|
-
fileName: _jsxFileName$3,
|
|
724
|
-
lineNumber: 34
|
|
725
|
-
}
|
|
726
|
-
}, children)));
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
DroppablePlaceholder.__initStatic();
|
|
730
|
-
const spec$1 = {
|
|
731
|
-
drop: (props, monitor) => {
|
|
732
|
-
log$1('[drop] props: ', props);
|
|
733
|
-
const item = monitor.getItem();
|
|
734
|
-
props.onDropChoice(item);
|
|
735
|
-
},
|
|
736
|
-
canDrop: props => {
|
|
737
|
-
return !props.disabled;
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
const WithTarget = DropTarget(({uid}) => uid, spec$1, (connect, monitor) => ({
|
|
741
|
-
connectDropTarget: connect.dropTarget(),
|
|
742
|
-
isOver: monitor.isOver()
|
|
743
|
-
}))(DroppablePlaceholder);
|
|
744
|
-
var PlaceHolder$1 = uid$1.withUid(WithTarget);
|
|
745
|
-
const React$4 = _dll_react;
|
|
746
|
-
const PropTypes$4 = _dll_prop_types;
|
|
747
|
-
const {withStyles: withStyles$3} = _dll_material_ui__core_styles;
|
|
748
|
-
const {color: color$1} = _dll_pie_lib__render_ui;
|
|
749
|
-
const _jsxFileName$4 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/categorize/src/categorize/category.jsx";
|
|
750
|
-
const CategoryType = {
|
|
751
|
-
id: PropTypes$4.string.isRequired,
|
|
752
|
-
categoryId: PropTypes$4.string
|
|
753
|
-
};
|
|
754
|
-
class Category extends React$4.Component {
|
|
755
|
-
static __initStatic() {
|
|
756
|
-
this.propTypes = {
|
|
757
|
-
...CategoryType,
|
|
758
|
-
className: PropTypes$4.string,
|
|
759
|
-
disabled: PropTypes$4.bool,
|
|
760
|
-
classes: PropTypes$4.object.isRequired,
|
|
761
|
-
onDropChoice: PropTypes$4.func,
|
|
762
|
-
onRemoveChoice: PropTypes$4.func
|
|
763
|
-
};
|
|
764
|
-
}
|
|
765
|
-
static __initStatic2() {
|
|
766
|
-
this.defaultProps = {};
|
|
767
|
-
}
|
|
768
|
-
render() {
|
|
769
|
-
const {classes, className, choices = [], disabled, onDropChoice, onRemoveChoice, grid, id, correct} = this.props;
|
|
770
|
-
const names = classnames(classes.category, className);
|
|
771
|
-
const placeholderNames = classnames(classes.placeholder, correct === false && classes.incorrect);
|
|
772
|
-
return React$4.createElement('div', {
|
|
773
|
-
className: names,
|
|
774
|
-
__self: this,
|
|
775
|
-
__source: {
|
|
776
|
-
fileName: _jsxFileName$4,
|
|
777
|
-
lineNumber: 47
|
|
778
|
-
}
|
|
779
|
-
}, React$4.createElement(PlaceHolder$1, {
|
|
780
|
-
grid: {
|
|
781
|
-
...grid,
|
|
782
|
-
rowsRepeatValue: 'minmax(60px, auto)'
|
|
783
|
-
},
|
|
784
|
-
onDropChoice: onDropChoice,
|
|
785
|
-
disabled: disabled,
|
|
786
|
-
className: placeholderNames,
|
|
787
|
-
__self: this,
|
|
788
|
-
__source: {
|
|
789
|
-
fileName: _jsxFileName$4,
|
|
790
|
-
lineNumber: 48
|
|
791
|
-
}
|
|
792
|
-
}, choices.map((c, index) => React$4.createElement(Choice$1, {
|
|
793
|
-
onRemoveChoice: onRemoveChoice,
|
|
794
|
-
disabled: disabled,
|
|
795
|
-
key: index,
|
|
796
|
-
choiceIndex: index,
|
|
797
|
-
categoryId: id,
|
|
798
|
-
...c,
|
|
799
|
-
__self: this,
|
|
800
|
-
__source: {
|
|
801
|
-
fileName: _jsxFileName$4,
|
|
802
|
-
lineNumber: 58
|
|
803
|
-
}
|
|
804
|
-
}))));
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
Category.__initStatic();
|
|
808
|
-
Category.__initStatic2();
|
|
809
|
-
const styles$3 = () => ({
|
|
810
|
-
incorrect: {
|
|
811
|
-
border: `solid 2px ${color$1.incorrect()}`
|
|
812
|
-
},
|
|
813
|
-
placeholder: {
|
|
814
|
-
minHeight: '60px',
|
|
815
|
-
flex: '1',
|
|
816
|
-
display: 'grid'
|
|
817
|
-
},
|
|
818
|
-
category: {
|
|
819
|
-
display: 'flex',
|
|
820
|
-
flexDirection: 'column'
|
|
821
|
-
}
|
|
822
|
-
});
|
|
823
|
-
var Category$1 = withStyles$3(styles$3)(Category);
|
|
824
|
-
const React$5 = _dll_react;
|
|
825
|
-
const PropTypes$5 = _dll_prop_types;
|
|
826
|
-
const {withStyles: withStyles$4} = _dll_material_ui__core_styles;
|
|
827
|
-
const {Typography: Typography} = _dll_material_ui__core;
|
|
828
|
-
const {color: color$2} = _dll_pie_lib__render_ui;
|
|
829
|
-
const {chunk: chunk} = _dll_lodash;
|
|
830
|
-
const _jsxFileName$5 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/categorize/src/categorize/categories.jsx";
|
|
831
|
-
class Categories extends React$5.Component {
|
|
832
|
-
static __initStatic() {
|
|
833
|
-
this.propTypes = {
|
|
834
|
-
classes: PropTypes$5.object.isRequired,
|
|
835
|
-
categories: PropTypes$5.arrayOf(PropTypes$5.shape(CategoryType)),
|
|
836
|
-
model: PropTypes$5.shape({
|
|
837
|
-
categoriesPerRow: PropTypes$5.number,
|
|
838
|
-
choicesPerRow: PropTypes$5.number
|
|
839
|
-
}),
|
|
840
|
-
disabled: PropTypes$5.bool,
|
|
841
|
-
onDropChoice: PropTypes$5.func.isRequired,
|
|
842
|
-
onRemoveChoice: PropTypes$5.func.isRequired
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
static __initStatic2() {
|
|
846
|
-
this.defaultProps = {
|
|
847
|
-
model: {
|
|
848
|
-
categoriesPerRow: 1,
|
|
849
|
-
choicesPerRow: 1
|
|
850
|
-
}
|
|
851
|
-
};
|
|
852
|
-
}
|
|
853
|
-
render() {
|
|
854
|
-
const {classes, categories, model, disabled, onDropChoice, onRemoveChoice} = this.props;
|
|
855
|
-
const {choicesPerRow, categoriesPerRow} = model;
|
|
856
|
-
const columns = choicesPerRow / categoriesPerRow;
|
|
857
|
-
const chunkedCategories = chunk(categories, categoriesPerRow);
|
|
858
|
-
return React$5.createElement(GridContent$1, {
|
|
859
|
-
columns: categoriesPerRow,
|
|
860
|
-
className: classes.categories,
|
|
861
|
-
rows: Math.ceil(categories.length / categoriesPerRow) * 2,
|
|
862
|
-
__self: this,
|
|
863
|
-
__source: {
|
|
864
|
-
fileName: _jsxFileName$5,
|
|
865
|
-
lineNumber: 52
|
|
866
|
-
}
|
|
867
|
-
}, chunkedCategories.map(cat => {
|
|
868
|
-
let items = [];
|
|
869
|
-
cat.forEach(c => {
|
|
870
|
-
items.push(React$5.createElement(Typography, {
|
|
871
|
-
className: classes.label,
|
|
872
|
-
key: `category-label-${c.label}`,
|
|
873
|
-
__self: this,
|
|
874
|
-
__source: {
|
|
875
|
-
fileName: _jsxFileName$5,
|
|
876
|
-
lineNumber: 64
|
|
877
|
-
}
|
|
878
|
-
}, React$5.createElement('span', {
|
|
879
|
-
dangerouslySetInnerHTML: {
|
|
880
|
-
__html: c.label
|
|
881
|
-
},
|
|
882
|
-
__self: this,
|
|
883
|
-
__source: {
|
|
884
|
-
fileName: _jsxFileName$5,
|
|
885
|
-
lineNumber: 65
|
|
886
|
-
}
|
|
887
|
-
})));
|
|
888
|
-
});
|
|
889
|
-
items = items.concat(Array(categoriesPerRow - cat.length).fill(React$5.createElement('div', {
|
|
890
|
-
__self: this,
|
|
891
|
-
__source: {
|
|
892
|
-
fileName: _jsxFileName$5,
|
|
893
|
-
lineNumber: 70
|
|
894
|
-
}
|
|
895
|
-
})));
|
|
896
|
-
cat.forEach((c, index) => {
|
|
897
|
-
const rows = Math.floor(c.choices.length / columns) + 1;
|
|
898
|
-
items.push(React$5.createElement(Category$1, {
|
|
899
|
-
grid: {
|
|
900
|
-
rows,
|
|
901
|
-
columns
|
|
902
|
-
},
|
|
903
|
-
onDropChoice: h => onDropChoice(c.id, h),
|
|
904
|
-
onRemoveChoice: onRemoveChoice,
|
|
905
|
-
disabled: disabled,
|
|
906
|
-
className: classes.category,
|
|
907
|
-
key: index,
|
|
908
|
-
...c,
|
|
909
|
-
__self: this,
|
|
910
|
-
__source: {
|
|
911
|
-
fileName: _jsxFileName$5,
|
|
912
|
-
lineNumber: 76
|
|
913
|
-
}
|
|
914
|
-
}));
|
|
915
|
-
});
|
|
916
|
-
items = items.concat(Array(categoriesPerRow - cat.length).fill(React$5.createElement('div', {
|
|
917
|
-
__self: this,
|
|
918
|
-
__source: {
|
|
919
|
-
fileName: _jsxFileName$5,
|
|
920
|
-
lineNumber: 88
|
|
921
|
-
}
|
|
922
|
-
})));
|
|
923
|
-
return items;
|
|
924
|
-
}));
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
Categories.__initStatic();
|
|
928
|
-
Categories.__initStatic2();
|
|
929
|
-
const styles$4 = theme => ({
|
|
930
|
-
categories: {
|
|
931
|
-
flex: 1
|
|
932
|
-
},
|
|
933
|
-
label: {
|
|
934
|
-
color: color$2.text(),
|
|
935
|
-
backgroundColor: color$2.background(),
|
|
936
|
-
textAlign: 'center',
|
|
937
|
-
paddingTop: theme.spacing.unit
|
|
938
|
-
}
|
|
939
|
-
});
|
|
940
|
-
var Categories$1 = withStyles$4(styles$4)(Categories);
|
|
941
|
-
browser('@pie-lib:categorize:scoring');
|
|
942
|
-
const {clone: clone} = _dll_lodash;
|
|
943
|
-
const log$2 = browser('@pie-lib:categorize');
|
|
944
|
-
const countChosen = (choice, categories) => {
|
|
945
|
-
if (!choice || !choice.id) {
|
|
946
|
-
return 0;
|
|
947
|
-
}
|
|
948
|
-
if (!Array.isArray(categories)) {
|
|
949
|
-
return 0;
|
|
950
|
-
}
|
|
951
|
-
return categories.reduce((acc, c) => {
|
|
952
|
-
const count = (c.choices || []).filter(h => h.id === choice.id).length;
|
|
953
|
-
return acc + count;
|
|
954
|
-
}, 0);
|
|
955
|
-
};
|
|
956
|
-
const removeChoiceFromCategory = (choiceId, categoryId, choiceIndex, answers) => {
|
|
957
|
-
log$2('[removeChoiceFromCategory] choiceIndex:', choiceIndex);
|
|
958
|
-
return answers.map(a => {
|
|
959
|
-
if (a.category === categoryId) {
|
|
960
|
-
const cloned = clone(a.choices);
|
|
961
|
-
const index = cloned.findIndex((v, index) => {
|
|
962
|
-
return v === choiceId && index >= choiceIndex;
|
|
963
|
-
});
|
|
964
|
-
if (index !== -1) {
|
|
965
|
-
cloned.splice(index, 1);
|
|
966
|
-
}
|
|
967
|
-
return {
|
|
968
|
-
...a,
|
|
969
|
-
choices: cloned
|
|
970
|
-
};
|
|
971
|
-
} else {
|
|
972
|
-
return a;
|
|
973
|
-
}
|
|
974
|
-
});
|
|
975
|
-
};
|
|
976
|
-
const moveChoiceToCategory = (choiceId, from, to, choiceIndex, answers) => {
|
|
977
|
-
log$2('[moveChoiceToCategory] choice: ', choiceId, 'from: ', from, 'to: ', to, 'answers: ', answers);
|
|
978
|
-
if (from === to) {
|
|
979
|
-
return answers;
|
|
980
|
-
}
|
|
981
|
-
if (from) {
|
|
982
|
-
answers = removeChoiceFromCategory(choiceId, from, choiceIndex, answers);
|
|
983
|
-
}
|
|
984
|
-
const index = answers.findIndex(a => a.category === to);
|
|
985
|
-
if (index === -1) {
|
|
986
|
-
answers.push({
|
|
987
|
-
category: to,
|
|
988
|
-
choices: [choiceId]
|
|
989
|
-
});
|
|
990
|
-
return answers;
|
|
991
|
-
} else {
|
|
992
|
-
return answers.map(a => {
|
|
993
|
-
if (a.category === to) {
|
|
994
|
-
a.choices = a.choices || [];
|
|
995
|
-
a.choices.push(choiceId);
|
|
996
|
-
return a;
|
|
997
|
-
}
|
|
998
|
-
return a;
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
};
|
|
1002
|
-
const stillSelectable = (h, builtCategories) => {
|
|
1003
|
-
if (h.categoryCount > 0) {
|
|
1004
|
-
const count = countChosen(h, builtCategories);
|
|
1005
|
-
return count < h.categoryCount;
|
|
1006
|
-
} else {
|
|
1007
|
-
return true;
|
|
1008
|
-
}
|
|
1009
|
-
};
|
|
1010
|
-
const buildChoices = (possibleResponseChoices, builtCategoryChoices) => {
|
|
1011
|
-
return builtCategoryChoices.reduce((acc, builtChoice) => {
|
|
1012
|
-
const index = acc.copyOfPossibleResponse.findIndex(cRC => cRC === builtChoice.id);
|
|
1013
|
-
if (index >= 0) {
|
|
1014
|
-
acc.builtChoices.push({
|
|
1015
|
-
...builtChoice,
|
|
1016
|
-
correct: true
|
|
1017
|
-
});
|
|
1018
|
-
acc.copyOfPossibleResponse = [...acc.copyOfPossibleResponse.slice(0, index), ...acc.copyOfPossibleResponse.slice(index + 1)];
|
|
1019
|
-
} else {
|
|
1020
|
-
acc.builtChoices.push({
|
|
1021
|
-
...builtChoice,
|
|
1022
|
-
correct: false
|
|
1023
|
-
});
|
|
1024
|
-
acc.allChoicesAreCorrect = false;
|
|
1025
|
-
}
|
|
1026
|
-
return acc;
|
|
1027
|
-
}, {
|
|
1028
|
-
builtChoices: [],
|
|
1029
|
-
copyOfPossibleResponse: [...possibleResponseChoices],
|
|
1030
|
-
allChoicesAreCorrect: true
|
|
1031
|
-
});
|
|
1032
|
-
};
|
|
1033
|
-
const getBuiltCategories = (possibleResponse, builtCategories) => builtCategories.reduce((acc, builtCategory) => {
|
|
1034
|
-
const possibleResponseChoices = possibleResponse[builtCategory.id] || [];
|
|
1035
|
-
const builtCategoryChoices = builtCategory.choices || [];
|
|
1036
|
-
const {builtChoices, allChoicesAreCorrect} = buildChoices(possibleResponseChoices, builtCategoryChoices);
|
|
1037
|
-
const allChoicesAreInAnswer = builtCategoryChoices.length === possibleResponseChoices.length;
|
|
1038
|
-
acc.builtCategories.push({
|
|
1039
|
-
...builtCategory,
|
|
1040
|
-
correct: allChoicesAreCorrect && allChoicesAreInAnswer,
|
|
1041
|
-
choices: builtChoices
|
|
1042
|
-
});
|
|
1043
|
-
acc.correct = acc.correct && allChoicesAreCorrect && allChoicesAreInAnswer;
|
|
1044
|
-
return acc;
|
|
1045
|
-
}, {
|
|
1046
|
-
builtCategories: [],
|
|
1047
|
-
correct: true
|
|
1048
|
-
});
|
|
1049
|
-
const getAllPossibleResponses = correctResponse => {
|
|
1050
|
-
if (!correctResponse) {
|
|
1051
|
-
return [];
|
|
1052
|
-
}
|
|
1053
|
-
return correctResponse.reduce((acc, cR) => {
|
|
1054
|
-
if (acc[0]) {
|
|
1055
|
-
acc[0][cR.category] = cR.choices;
|
|
1056
|
-
} else {
|
|
1057
|
-
acc.push({
|
|
1058
|
-
[cR.category]: cR.choices
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
if (cR.alternateResponses) {
|
|
1062
|
-
cR.alternateResponses.forEach((aR, index) => {
|
|
1063
|
-
if (acc[index + 1]) {
|
|
1064
|
-
acc[index + 1][cR.category] = aR;
|
|
1065
|
-
} else {
|
|
1066
|
-
acc.push({
|
|
1067
|
-
[cR.category]: aR
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
return acc;
|
|
1073
|
-
}, []);
|
|
1074
|
-
};
|
|
1075
|
-
const buildCategories = (categories, choices, answers) => {
|
|
1076
|
-
categories = categories || [];
|
|
1077
|
-
answers = answers || [];
|
|
1078
|
-
choices = choices || [];
|
|
1079
|
-
return categories.map(category => {
|
|
1080
|
-
const answer = answers.find(answer => answer.category === category.id);
|
|
1081
|
-
const {choices: answerChoices = []} = answer || ({});
|
|
1082
|
-
return {
|
|
1083
|
-
...category,
|
|
1084
|
-
choices: answerChoices.map(chId => choices.find(ch => ch.id === chId))
|
|
1085
|
-
};
|
|
1086
|
-
});
|
|
1087
|
-
};
|
|
1088
|
-
const buildState = (categories, choices, answers, correctResponse) => {
|
|
1089
|
-
categories = categories || [];
|
|
1090
|
-
choices = choices || [];
|
|
1091
|
-
answers = answers || [];
|
|
1092
|
-
const allResponses = getAllPossibleResponses(correctResponse) || [];
|
|
1093
|
-
let builtCategories = buildCategories(categories, choices, answers);
|
|
1094
|
-
let bestResponse;
|
|
1095
|
-
let entirelyCorrect;
|
|
1096
|
-
if (allResponses.length) {
|
|
1097
|
-
const builtData = allResponses.reduce((acc, possibleResponse) => {
|
|
1098
|
-
const {builtCategories: categoriesWithChoices, correct} = getBuiltCategories(possibleResponse, builtCategories);
|
|
1099
|
-
if (acc.bestResponse === null || !acc.entirelyCorrect && correct) {
|
|
1100
|
-
return {
|
|
1101
|
-
bestResponse: possibleResponse,
|
|
1102
|
-
builtCategories: categoriesWithChoices,
|
|
1103
|
-
entirelyCorrect: correct
|
|
1104
|
-
};
|
|
1105
|
-
}
|
|
1106
|
-
return acc;
|
|
1107
|
-
}, {
|
|
1108
|
-
bestResponse: null,
|
|
1109
|
-
builtCategories: [],
|
|
1110
|
-
entirelyCorrect: false
|
|
1111
|
-
});
|
|
1112
|
-
builtCategories = builtData.builtCategories;
|
|
1113
|
-
bestResponse = builtData.bestResponse;
|
|
1114
|
-
entirelyCorrect = builtData.entirelyCorrect;
|
|
1115
|
-
}
|
|
1116
|
-
const filteredChoices = choices.map(ch => stillSelectable(ch, builtCategories) ? ch : {
|
|
1117
|
-
empty: true
|
|
1118
|
-
});
|
|
1119
|
-
return {
|
|
1120
|
-
choices: filteredChoices,
|
|
1121
|
-
categories: builtCategories,
|
|
1122
|
-
correct: entirelyCorrect,
|
|
1123
|
-
bestResponse
|
|
1124
|
-
};
|
|
1125
|
-
};
|
|
1126
|
-
const React$6 = _dll_react;
|
|
1127
|
-
const PropTypes$6 = _dll_prop_types;
|
|
1128
|
-
const CorrectAnswerToggle = _dll_pie_lib__correct_answer_toggle;
|
|
1129
|
-
const {withStyles: withStyles$5} = _dll_material_ui__core_styles;
|
|
1130
|
-
const {withDragContext: withDragContext} = _dll_pie_lib__drag;
|
|
1131
|
-
const {uid: uid$2} = _dll_pie_lib__drag;
|
|
1132
|
-
const {color: color$3} = _dll_pie_lib__render_ui;
|
|
1133
|
-
const {Feedback: Feedback} = _dll_pie_lib__render_ui;
|
|
1134
|
-
const {Collapsible: Collapsible} = _dll_pie_lib__render_ui;
|
|
1135
|
-
const {hasText: hasText} = _dll_pie_lib__render_ui;
|
|
1136
|
-
const _jsxFileName$6 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/categorize/src/categorize/index.jsx";
|
|
1137
|
-
const log$3 = browser('@pie-ui:categorize');
|
|
1138
|
-
const removeHTMLTags = html => {
|
|
1139
|
-
const tmp = document.createElement('DIV');
|
|
1140
|
-
tmp.innerHTML = html;
|
|
1141
|
-
const value = tmp.textContent || tmp.innerText || '';
|
|
1142
|
-
return value.trim();
|
|
1143
|
-
};
|
|
1144
|
-
class Categorize extends React$6.Component {
|
|
1145
|
-
static __initStatic() {
|
|
1146
|
-
this.propTypes = {
|
|
1147
|
-
classes: PropTypes$6.object.isRequired,
|
|
1148
|
-
model: PropTypes$6.object,
|
|
1149
|
-
session: PropTypes$6.shape({
|
|
1150
|
-
answers: PropTypes$6.arrayOf(PropTypes$6.shape({
|
|
1151
|
-
choice: PropTypes$6.string,
|
|
1152
|
-
category: PropTypes$6.string
|
|
1153
|
-
}))
|
|
1154
|
-
}),
|
|
1155
|
-
onAnswersChange: PropTypes$6.func.isRequired,
|
|
1156
|
-
onShowCorrectToggle: PropTypes$6.func.isRequired
|
|
1157
|
-
};
|
|
1158
|
-
}
|
|
1159
|
-
static __initStatic2() {
|
|
1160
|
-
this.defaultProps = {
|
|
1161
|
-
disabled: false
|
|
1162
|
-
};
|
|
1163
|
-
}
|
|
1164
|
-
constructor(props) {
|
|
1165
|
-
super(props);
|
|
1166
|
-
Categorize.prototype.__init.call(this);
|
|
1167
|
-
Categorize.prototype.__init2.call(this);
|
|
1168
|
-
Categorize.prototype.__init3.call(this);
|
|
1169
|
-
Categorize.prototype.__init4.call(this);
|
|
1170
|
-
this.state = {
|
|
1171
|
-
showCorrect: false
|
|
1172
|
-
};
|
|
1173
|
-
}
|
|
1174
|
-
__init() {
|
|
1175
|
-
this.dropChoice = (categoryId, draggedChoice) => {
|
|
1176
|
-
const {session, onAnswersChange} = this.props;
|
|
1177
|
-
log$3('[dropChoice] category: ', draggedChoice.categoryId, 'choice: ', draggedChoice);
|
|
1178
|
-
const answers = moveChoiceToCategory(draggedChoice.id, draggedChoice.categoryId, categoryId, draggedChoice.choiceIndex, session.answers);
|
|
1179
|
-
onAnswersChange(answers);
|
|
1180
|
-
};
|
|
1181
|
-
}
|
|
1182
|
-
__init2() {
|
|
1183
|
-
this.removeChoice = c => {
|
|
1184
|
-
log$3('[removeChoice]: ', c);
|
|
1185
|
-
const {onAnswersChange, session} = this.props;
|
|
1186
|
-
const answers = removeChoiceFromCategory(c.id, c.categoryId, c.choiceIndex, session.answers);
|
|
1187
|
-
onAnswersChange(answers);
|
|
1188
|
-
};
|
|
1189
|
-
}
|
|
1190
|
-
UNSAFE_componentWillReceiveProps() {
|
|
1191
|
-
this.setState({
|
|
1192
|
-
showCorrect: false
|
|
1193
|
-
});
|
|
1194
|
-
}
|
|
1195
|
-
__init3() {
|
|
1196
|
-
this.toggleShowCorrect = () => this.setState({
|
|
1197
|
-
showCorrect: !this.state.showCorrect
|
|
1198
|
-
}, () => {
|
|
1199
|
-
this.props.onShowCorrectToggle();
|
|
1200
|
-
});
|
|
1201
|
-
}
|
|
1202
|
-
__init4() {
|
|
1203
|
-
this.getPositionDirection = choicePosition => {
|
|
1204
|
-
let flexDirection;
|
|
1205
|
-
switch (choicePosition) {
|
|
1206
|
-
case 'left':
|
|
1207
|
-
flexDirection = 'row-reverse';
|
|
1208
|
-
break;
|
|
1209
|
-
case 'right':
|
|
1210
|
-
flexDirection = 'row';
|
|
1211
|
-
break;
|
|
1212
|
-
case 'below':
|
|
1213
|
-
flexDirection = 'column';
|
|
1214
|
-
break;
|
|
1215
|
-
default:
|
|
1216
|
-
flexDirection = 'column-reverse';
|
|
1217
|
-
break;
|
|
1218
|
-
}
|
|
1219
|
-
return flexDirection;
|
|
1220
|
-
};
|
|
1221
|
-
}
|
|
1222
|
-
render() {
|
|
1223
|
-
const {classes, model, session} = this.props;
|
|
1224
|
-
const {showCorrect} = this.state;
|
|
1225
|
-
const {choicesPosition} = model;
|
|
1226
|
-
const choicePosition = choicesPosition || 'above';
|
|
1227
|
-
const style = {
|
|
1228
|
-
flexDirection: this.getPositionDirection(choicePosition)
|
|
1229
|
-
};
|
|
1230
|
-
const {categories, choices, correct} = buildState(model.categories, model.choices, showCorrect ? model.correctResponse : session.answers, model.correctResponse);
|
|
1231
|
-
log$3('[render] disabled: ', model.disabled);
|
|
1232
|
-
const {rowLabels} = model;
|
|
1233
|
-
return React$6.createElement('div', {
|
|
1234
|
-
className: classes.mainContainer,
|
|
1235
|
-
__self: this,
|
|
1236
|
-
__source: {
|
|
1237
|
-
fileName: _jsxFileName$6,
|
|
1238
|
-
lineNumber: 142
|
|
1239
|
-
}
|
|
1240
|
-
}, model.teacherInstructions && hasText(model.teacherInstructions) && React$6.createElement(Collapsible, {
|
|
1241
|
-
labels: {
|
|
1242
|
-
hidden: 'Show Teacher Instructions',
|
|
1243
|
-
visible: 'Hide Teacher Instructions'
|
|
1244
|
-
},
|
|
1245
|
-
className: classes.collapsible,
|
|
1246
|
-
__self: this,
|
|
1247
|
-
__source: {
|
|
1248
|
-
fileName: _jsxFileName$6,
|
|
1249
|
-
lineNumber: 145
|
|
1250
|
-
}
|
|
1251
|
-
}, React$6.createElement('div', {
|
|
1252
|
-
dangerouslySetInnerHTML: {
|
|
1253
|
-
__html: model.teacherInstructions
|
|
1254
|
-
},
|
|
1255
|
-
__self: this,
|
|
1256
|
-
__source: {
|
|
1257
|
-
fileName: _jsxFileName$6,
|
|
1258
|
-
lineNumber: 149
|
|
1259
|
-
}
|
|
1260
|
-
})), React$6.createElement('br', {
|
|
1261
|
-
__self: this,
|
|
1262
|
-
__source: {
|
|
1263
|
-
fileName: _jsxFileName$6,
|
|
1264
|
-
lineNumber: 153
|
|
1265
|
-
}
|
|
1266
|
-
}), React$6.createElement(CorrectAnswerToggle, {
|
|
1267
|
-
show: showCorrect || correct === false,
|
|
1268
|
-
toggled: showCorrect,
|
|
1269
|
-
onToggle: this.toggleShowCorrect,
|
|
1270
|
-
__self: this,
|
|
1271
|
-
__source: {
|
|
1272
|
-
fileName: _jsxFileName$6,
|
|
1273
|
-
lineNumber: 154
|
|
1274
|
-
}
|
|
1275
|
-
}), removeHTMLTags(model.prompt) && React$6.createElement('div', {
|
|
1276
|
-
className: classes.prompt,
|
|
1277
|
-
dangerouslySetInnerHTML: {
|
|
1278
|
-
__html: model.prompt
|
|
1279
|
-
},
|
|
1280
|
-
__self: this,
|
|
1281
|
-
__source: {
|
|
1282
|
-
fileName: _jsxFileName$6,
|
|
1283
|
-
lineNumber: 161
|
|
1284
|
-
}
|
|
1285
|
-
}), React$6.createElement('div', {
|
|
1286
|
-
className: classes.categorize,
|
|
1287
|
-
style: style,
|
|
1288
|
-
__self: this,
|
|
1289
|
-
__source: {
|
|
1290
|
-
fileName: _jsxFileName$6,
|
|
1291
|
-
lineNumber: 166
|
|
1292
|
-
}
|
|
1293
|
-
}, React$6.createElement('div', {
|
|
1294
|
-
style: {
|
|
1295
|
-
display: 'flex'
|
|
1296
|
-
},
|
|
1297
|
-
__self: this,
|
|
1298
|
-
__source: {
|
|
1299
|
-
fileName: _jsxFileName$6,
|
|
1300
|
-
lineNumber: 167
|
|
1301
|
-
}
|
|
1302
|
-
}, rowLabels && React$6.createElement('div', {
|
|
1303
|
-
style: {
|
|
1304
|
-
display: 'grid',
|
|
1305
|
-
marginRight: '20px'
|
|
1306
|
-
},
|
|
1307
|
-
__self: this,
|
|
1308
|
-
__source: {
|
|
1309
|
-
fileName: _jsxFileName$6,
|
|
1310
|
-
lineNumber: 170
|
|
1311
|
-
}
|
|
1312
|
-
}, rowLabels.map((label, index) => React$6.createElement('div', {
|
|
1313
|
-
key: index,
|
|
1314
|
-
style: {
|
|
1315
|
-
alignItems: 'center',
|
|
1316
|
-
display: 'flex',
|
|
1317
|
-
justifyContent: 'center'
|
|
1318
|
-
},
|
|
1319
|
-
dangerouslySetInnerHTML: {
|
|
1320
|
-
__html: label
|
|
1321
|
-
},
|
|
1322
|
-
__self: this,
|
|
1323
|
-
__source: {
|
|
1324
|
-
fileName: _jsxFileName$6,
|
|
1325
|
-
lineNumber: 172
|
|
1326
|
-
}
|
|
1327
|
-
}))), React$6.createElement(Categories$1, {
|
|
1328
|
-
model: model,
|
|
1329
|
-
disabled: model.disabled,
|
|
1330
|
-
categories: categories,
|
|
1331
|
-
onDropChoice: this.dropChoice,
|
|
1332
|
-
onRemoveChoice: this.removeChoice,
|
|
1333
|
-
__self: this,
|
|
1334
|
-
__source: {
|
|
1335
|
-
fileName: _jsxFileName$6,
|
|
1336
|
-
lineNumber: 187
|
|
1337
|
-
}
|
|
1338
|
-
})), React$6.createElement(Choices$1, {
|
|
1339
|
-
disabled: model.disabled,
|
|
1340
|
-
model: model,
|
|
1341
|
-
choices: choices,
|
|
1342
|
-
choicePosition: choicePosition,
|
|
1343
|
-
__self: this,
|
|
1344
|
-
__source: {
|
|
1345
|
-
fileName: _jsxFileName$6,
|
|
1346
|
-
lineNumber: 195
|
|
1347
|
-
}
|
|
1348
|
-
})), model.rationale && hasText(model.rationale) && React$6.createElement(Collapsible, {
|
|
1349
|
-
labels: {
|
|
1350
|
-
hidden: 'Show Rationale',
|
|
1351
|
-
visible: 'Hide Rationale'
|
|
1352
|
-
},
|
|
1353
|
-
className: classes.collapsible,
|
|
1354
|
-
__self: this,
|
|
1355
|
-
__source: {
|
|
1356
|
-
fileName: _jsxFileName$6,
|
|
1357
|
-
lineNumber: 204
|
|
1358
|
-
}
|
|
1359
|
-
}, React$6.createElement('div', {
|
|
1360
|
-
dangerouslySetInnerHTML: {
|
|
1361
|
-
__html: model.rationale
|
|
1362
|
-
},
|
|
1363
|
-
__self: this,
|
|
1364
|
-
__source: {
|
|
1365
|
-
fileName: _jsxFileName$6,
|
|
1366
|
-
lineNumber: 208
|
|
1367
|
-
}
|
|
1368
|
-
})), model.correctness && model.feedback && !showCorrect && React$6.createElement(Feedback, {
|
|
1369
|
-
correctness: model.correctness,
|
|
1370
|
-
feedback: model.feedback,
|
|
1371
|
-
__self: this,
|
|
1372
|
-
__source: {
|
|
1373
|
-
fileName: _jsxFileName$6,
|
|
1374
|
-
lineNumber: 216
|
|
1375
|
-
}
|
|
1376
|
-
}));
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
Categorize.__initStatic();
|
|
1380
|
-
Categorize.__initStatic2();
|
|
1381
|
-
class CategorizeProvider extends React$6.Component {
|
|
1382
|
-
constructor(props) {
|
|
1383
|
-
super(props);
|
|
1384
|
-
this.uid = uid$2.generateId();
|
|
1385
|
-
}
|
|
1386
|
-
render() {
|
|
1387
|
-
return React$6.createElement(uid$2.Provider, {
|
|
1388
|
-
value: this.uid,
|
|
1389
|
-
__self: this,
|
|
1390
|
-
__source: {
|
|
1391
|
-
fileName: _jsxFileName$6,
|
|
1392
|
-
lineNumber: 235
|
|
1393
|
-
}
|
|
1394
|
-
}, React$6.createElement(Categorize, {
|
|
1395
|
-
...this.props,
|
|
1396
|
-
__self: this,
|
|
1397
|
-
__source: {
|
|
1398
|
-
fileName: _jsxFileName$6,
|
|
1399
|
-
lineNumber: 236
|
|
1400
|
-
}
|
|
1401
|
-
}));
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
const styles$5 = theme => ({
|
|
1405
|
-
mainContainer: {
|
|
1406
|
-
padding: theme.spacing.unit,
|
|
1407
|
-
color: color$3.text(),
|
|
1408
|
-
backgroundColor: color$3.background()
|
|
1409
|
-
},
|
|
1410
|
-
prompt: {
|
|
1411
|
-
marginBottom: '35px',
|
|
1412
|
-
verticalAlign: 'middle'
|
|
1413
|
-
},
|
|
1414
|
-
categorize: {
|
|
1415
|
-
marginBottom: theme.spacing.unit,
|
|
1416
|
-
display: 'flex',
|
|
1417
|
-
flexDirection: 'column'
|
|
1418
|
-
},
|
|
1419
|
-
collapsible: {
|
|
1420
|
-
paddingBottom: theme.spacing.unit * 2
|
|
1421
|
-
}
|
|
1422
|
-
});
|
|
1423
|
-
var CategorizeComponent = withDragContext(withStyles$5(styles$5)(CategorizeProvider));
|
|
1424
|
-
const React$7 = _dll_react;
|
|
1425
|
-
const ReactDOM = _dll_react_dom;
|
|
1426
|
-
const {renderMath: renderMath} = _dll_pie_lib__math_rendering;
|
|
1427
|
-
const {SessionChangedEvent: SessionChangedEvent} = _dll_pie_framework__pie_player_events;
|
|
1428
|
-
const {ModelSetEvent: ModelSetEvent} = _dll_pie_framework__pie_player_events;
|
|
1429
|
-
class Categorize$1 extends HTMLElement {
|
|
1430
|
-
set model(m) {
|
|
1431
|
-
this._model = m;
|
|
1432
|
-
this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this.isComplete(), !!this._model));
|
|
1433
|
-
this.render();
|
|
1434
|
-
}
|
|
1435
|
-
isComplete() {
|
|
1436
|
-
if (!this._session) {
|
|
1437
|
-
return false;
|
|
1438
|
-
}
|
|
1439
|
-
return Array.isArray(this._session.answers) && this._session.answers.length > 0;
|
|
1440
|
-
}
|
|
1441
|
-
set session(s) {
|
|
1442
|
-
if (s && !s.answers) {
|
|
1443
|
-
s.answers = [];
|
|
1444
|
-
}
|
|
1445
|
-
this._session = s;
|
|
1446
|
-
this.render();
|
|
1447
|
-
}
|
|
1448
|
-
changeAnswers(answers) {
|
|
1449
|
-
this._session.answers = answers;
|
|
1450
|
-
this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete()));
|
|
1451
|
-
this.render();
|
|
1452
|
-
}
|
|
1453
|
-
onShowCorrectToggle() {
|
|
1454
|
-
renderMath(this);
|
|
1455
|
-
}
|
|
1456
|
-
render() {
|
|
1457
|
-
if (this._model && this._session) {
|
|
1458
|
-
const el = React$7.createElement(CategorizeComponent, {
|
|
1459
|
-
model: this._model,
|
|
1460
|
-
session: this._session,
|
|
1461
|
-
onAnswersChange: this.changeAnswers.bind(this),
|
|
1462
|
-
onShowCorrectToggle: this.onShowCorrectToggle.bind(this)
|
|
1463
|
-
});
|
|
1464
|
-
ReactDOM.render(el, this, () => {
|
|
1465
|
-
renderMath(this);
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
export default Categorize$1;
|