@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.
Files changed (75) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/configure/CHANGELOG.md +117 -0
  3. package/configure/lib/defaults.js +11 -1
  4. package/configure/lib/defaults.js.map +1 -1
  5. package/configure/lib/design/builder.js +1 -1
  6. package/configure/lib/design/buttons.js +6 -4
  7. package/configure/lib/design/buttons.js.map +1 -1
  8. package/configure/lib/design/categories/alternateResponses.js +4 -2
  9. package/configure/lib/design/categories/alternateResponses.js.map +1 -1
  10. package/configure/lib/design/categories/category.js +9 -4
  11. package/configure/lib/design/categories/category.js.map +1 -1
  12. package/configure/lib/design/categories/choice-preview.js +4 -4
  13. package/configure/lib/design/categories/choice-preview.js.map +1 -1
  14. package/configure/lib/design/categories/droppable-placeholder.js +3 -3
  15. package/configure/lib/design/categories/droppable-placeholder.js.map +1 -1
  16. package/configure/lib/design/categories/index.js +69 -10
  17. package/configure/lib/design/categories/index.js.map +1 -1
  18. package/configure/lib/design/choices/choice.js +21 -6
  19. package/configure/lib/design/choices/choice.js.map +1 -1
  20. package/configure/lib/design/choices/config.js +5 -3
  21. package/configure/lib/design/choices/config.js.map +1 -1
  22. package/configure/lib/design/choices/index.js +34 -8
  23. package/configure/lib/design/choices/index.js.map +1 -1
  24. package/configure/lib/design/header.js +15 -5
  25. package/configure/lib/design/header.js.map +1 -1
  26. package/configure/lib/design/index.js +41 -11
  27. package/configure/lib/design/index.js.map +1 -1
  28. package/configure/lib/design/input-header.js +12 -4
  29. package/configure/lib/design/input-header.js.map +1 -1
  30. package/configure/lib/index.js +3 -3
  31. package/configure/lib/main.js +1 -1
  32. package/configure/lib/main.js.map +1 -1
  33. package/configure/lib/utils.js +20 -0
  34. package/configure/lib/utils.js.map +1 -0
  35. package/configure/package.json +4 -4
  36. package/controller/CHANGELOG.md +16 -0
  37. package/controller/lib/index.js +83 -3
  38. package/controller/lib/index.js.map +1 -1
  39. package/controller/package.json +1 -1
  40. package/docs/config-schema.json +31 -0
  41. package/docs/config-schema.json.md +24 -0
  42. package/docs/demo/generate.js +1 -0
  43. package/docs/pie-schema.json +16 -0
  44. package/docs/pie-schema.json.md +15 -0
  45. package/lib/categorize/categories.js +9 -4
  46. package/lib/categorize/categories.js.map +1 -1
  47. package/lib/categorize/category.js +4 -4
  48. package/lib/categorize/category.js.map +1 -1
  49. package/lib/categorize/choice.js +5 -4
  50. package/lib/categorize/choice.js.map +1 -1
  51. package/lib/categorize/choices.js +12 -5
  52. package/lib/categorize/choices.js.map +1 -1
  53. package/lib/categorize/droppable-placeholder.js +2 -2
  54. package/lib/categorize/droppable-placeholder.js.map +1 -1
  55. package/lib/categorize/grid-content.js +3 -3
  56. package/lib/categorize/grid-content.js.map +1 -1
  57. package/lib/categorize/index.js +11 -15
  58. package/lib/categorize/index.js.map +1 -1
  59. package/lib/index.js +4 -1
  60. package/lib/index.js.map +1 -1
  61. package/package.json +5 -5
  62. package/docs/demo/.pie/.configure/package.json +0 -10
  63. package/docs/demo/.pie/.configure/yarn.lock +0 -1128
  64. package/docs/demo/.pie/.controllers/package.json +0 -10
  65. package/docs/demo/.pie/.controllers/yarn.lock +0 -43
  66. package/docs/demo/.pie/info.entry.js +0 -89
  67. package/docs/demo/.pie/info.webpack.config.js +0 -108
  68. package/docs/demo/.pie/package.json +0 -10
  69. package/docs/demo/.pie/yarn.lock +0 -579
  70. package/module/configure.js +0 -3155
  71. package/module/controller.js +0 -19950
  72. package/module/demo.js +0 -118
  73. package/module/element.js +0 -1470
  74. package/module/index.html +0 -16
  75. package/module/manifest.json +0 -10
@@ -1,3155 +0,0 @@
1
- import {_dll_lodash, _dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_pie_lib__drag, _dll_pie_lib__render_ui, _dll_react_dnd, _dll_react_dom} from "../../../@pie-ui/shared-lib@^4.3.3/module/index.js";
2
- import {_dll_pie_lib__editable_html, _dll_pie_lib__config_ui, _dll_pie_framework__pie_configure_events} from "../../shared-config@^1.8.13/module/index.js";
3
- function unwrapExports(x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
- }
6
- function createCommonjsModule(fn, module) {
7
- return (module = {
8
- exports: {}
9
- }, fn(module, module.exports), module.exports);
10
- }
11
- var classnames = createCommonjsModule(function (module) {
12
- (function () {
13
- var hasOwn = ({}).hasOwnProperty;
14
- function classNames() {
15
- var classes = [];
16
- for (var i = 0; i < arguments.length; i++) {
17
- var arg = arguments[i];
18
- if (!arg) continue;
19
- var argType = typeof arg;
20
- if (argType === 'string' || argType === 'number') {
21
- classes.push(arg);
22
- } else if (Array.isArray(arg) && arg.length) {
23
- var inner = classNames.apply(null, arg);
24
- if (inner) {
25
- classes.push(inner);
26
- }
27
- } else if (argType === 'object') {
28
- for (var key in arg) {
29
- if (hasOwn.call(arg, key) && arg[key]) {
30
- classes.push(key);
31
- }
32
- }
33
- }
34
- }
35
- return classes.join(' ');
36
- }
37
- if (module.exports) {
38
- classNames.default = classNames;
39
- module.exports = classNames;
40
- } else {
41
- window.classNames = classNames;
42
- }
43
- })();
44
- });
45
- var s = 1000;
46
- var m = s * 60;
47
- var h = m * 60;
48
- var d = h * 24;
49
- var w = d * 7;
50
- var y = d * 365.25;
51
- var ms = function (val, options) {
52
- options = options || ({});
53
- var type = typeof val;
54
- if (type === 'string' && val.length > 0) {
55
- return parse(val);
56
- } else if (type === 'number' && isFinite(val)) {
57
- return options.long ? fmtLong(val) : fmtShort(val);
58
- }
59
- throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
60
- };
61
- function parse(str) {
62
- str = String(str);
63
- if (str.length > 100) {
64
- return;
65
- }
66
- 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);
67
- if (!match) {
68
- return;
69
- }
70
- var n = parseFloat(match[1]);
71
- var type = (match[2] || 'ms').toLowerCase();
72
- switch (type) {
73
- case 'years':
74
- case 'year':
75
- case 'yrs':
76
- case 'yr':
77
- case 'y':
78
- return n * y;
79
- case 'weeks':
80
- case 'week':
81
- case 'w':
82
- return n * w;
83
- case 'days':
84
- case 'day':
85
- case 'd':
86
- return n * d;
87
- case 'hours':
88
- case 'hour':
89
- case 'hrs':
90
- case 'hr':
91
- case 'h':
92
- return n * h;
93
- case 'minutes':
94
- case 'minute':
95
- case 'mins':
96
- case 'min':
97
- case 'm':
98
- return n * m;
99
- case 'seconds':
100
- case 'second':
101
- case 'secs':
102
- case 'sec':
103
- case 's':
104
- return n * s;
105
- case 'milliseconds':
106
- case 'millisecond':
107
- case 'msecs':
108
- case 'msec':
109
- case 'ms':
110
- return n;
111
- default:
112
- return undefined;
113
- }
114
- }
115
- function fmtShort(ms) {
116
- var msAbs = Math.abs(ms);
117
- if (msAbs >= d) {
118
- return Math.round(ms / d) + 'd';
119
- }
120
- if (msAbs >= h) {
121
- return Math.round(ms / h) + 'h';
122
- }
123
- if (msAbs >= m) {
124
- return Math.round(ms / m) + 'm';
125
- }
126
- if (msAbs >= s) {
127
- return Math.round(ms / s) + 's';
128
- }
129
- return ms + 'ms';
130
- }
131
- function fmtLong(ms) {
132
- var msAbs = Math.abs(ms);
133
- if (msAbs >= d) {
134
- return plural(ms, msAbs, d, 'day');
135
- }
136
- if (msAbs >= h) {
137
- return plural(ms, msAbs, h, 'hour');
138
- }
139
- if (msAbs >= m) {
140
- return plural(ms, msAbs, m, 'minute');
141
- }
142
- if (msAbs >= s) {
143
- return plural(ms, msAbs, s, 'second');
144
- }
145
- return ms + ' ms';
146
- }
147
- function plural(ms, msAbs, n, name) {
148
- var isPlural = msAbs >= n * 1.5;
149
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
150
- }
151
- function setup(env) {
152
- createDebug.debug = createDebug;
153
- createDebug.default = createDebug;
154
- createDebug.coerce = coerce;
155
- createDebug.disable = disable;
156
- createDebug.enable = enable;
157
- createDebug.enabled = enabled;
158
- createDebug.humanize = ms;
159
- createDebug.destroy = destroy;
160
- Object.keys(env).forEach(key => {
161
- createDebug[key] = env[key];
162
- });
163
- createDebug.names = [];
164
- createDebug.skips = [];
165
- createDebug.formatters = {};
166
- function selectColor(namespace) {
167
- let hash = 0;
168
- for (let i = 0; i < namespace.length; i++) {
169
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
170
- hash |= 0;
171
- }
172
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
173
- }
174
- createDebug.selectColor = selectColor;
175
- function createDebug(namespace) {
176
- let prevTime;
177
- let enableOverride = null;
178
- function debug(...args) {
179
- if (!debug.enabled) {
180
- return;
181
- }
182
- const self = debug;
183
- const curr = Number(new Date());
184
- const ms = curr - (prevTime || curr);
185
- self.diff = ms;
186
- self.prev = prevTime;
187
- self.curr = curr;
188
- prevTime = curr;
189
- args[0] = createDebug.coerce(args[0]);
190
- if (typeof args[0] !== 'string') {
191
- args.unshift('%O');
192
- }
193
- let index = 0;
194
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
195
- if (match === '%%') {
196
- return '%';
197
- }
198
- index++;
199
- const formatter = createDebug.formatters[format];
200
- if (typeof formatter === 'function') {
201
- const val = args[index];
202
- match = formatter.call(self, val);
203
- args.splice(index, 1);
204
- index--;
205
- }
206
- return match;
207
- });
208
- createDebug.formatArgs.call(self, args);
209
- const logFn = self.log || createDebug.log;
210
- logFn.apply(self, args);
211
- }
212
- debug.namespace = namespace;
213
- debug.useColors = createDebug.useColors();
214
- debug.color = createDebug.selectColor(namespace);
215
- debug.extend = extend;
216
- debug.destroy = createDebug.destroy;
217
- Object.defineProperty(debug, 'enabled', {
218
- enumerable: true,
219
- configurable: false,
220
- get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
221
- set: v => {
222
- enableOverride = v;
223
- }
224
- });
225
- if (typeof createDebug.init === 'function') {
226
- createDebug.init(debug);
227
- }
228
- return debug;
229
- }
230
- function extend(namespace, delimiter) {
231
- const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
232
- newDebug.log = this.log;
233
- return newDebug;
234
- }
235
- function enable(namespaces) {
236
- createDebug.save(namespaces);
237
- createDebug.names = [];
238
- createDebug.skips = [];
239
- let i;
240
- const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
241
- const len = split.length;
242
- for (i = 0; i < len; i++) {
243
- if (!split[i]) {
244
- continue;
245
- }
246
- namespaces = split[i].replace(/\*/g, '.*?');
247
- if (namespaces[0] === '-') {
248
- createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
249
- } else {
250
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
251
- }
252
- }
253
- }
254
- function disable() {
255
- const namespaces = [...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)].join(',');
256
- createDebug.enable('');
257
- return namespaces;
258
- }
259
- function enabled(name) {
260
- if (name[name.length - 1] === '*') {
261
- return true;
262
- }
263
- let i;
264
- let len;
265
- for ((i = 0, len = createDebug.skips.length); i < len; i++) {
266
- if (createDebug.skips[i].test(name)) {
267
- return false;
268
- }
269
- }
270
- for ((i = 0, len = createDebug.names.length); i < len; i++) {
271
- if (createDebug.names[i].test(name)) {
272
- return true;
273
- }
274
- }
275
- return false;
276
- }
277
- function toNamespace(regexp) {
278
- return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
279
- }
280
- function coerce(val) {
281
- if (val instanceof Error) {
282
- return val.stack || val.message;
283
- }
284
- return val;
285
- }
286
- function destroy() {
287
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
288
- }
289
- createDebug.enable(createDebug.load());
290
- return createDebug;
291
- }
292
- var common = setup;
293
- var browser = createCommonjsModule(function (module, exports) {
294
- exports.formatArgs = formatArgs;
295
- exports.save = save;
296
- exports.load = load;
297
- exports.useColors = useColors;
298
- exports.storage = localstorage();
299
- exports.destroy = (() => {
300
- let warned = false;
301
- return () => {
302
- if (!warned) {
303
- warned = true;
304
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
305
- }
306
- };
307
- })();
308
- 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'];
309
- function useColors() {
310
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
311
- return true;
312
- }
313
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
314
- return false;
315
- }
316
- 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+)/);
317
- }
318
- function formatArgs(args) {
319
- args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
320
- if (!this.useColors) {
321
- return;
322
- }
323
- const c = 'color: ' + this.color;
324
- args.splice(1, 0, c, 'color: inherit');
325
- let index = 0;
326
- let lastC = 0;
327
- args[0].replace(/%[a-zA-Z%]/g, match => {
328
- if (match === '%%') {
329
- return;
330
- }
331
- index++;
332
- if (match === '%c') {
333
- lastC = index;
334
- }
335
- });
336
- args.splice(lastC, 0, c);
337
- }
338
- exports.log = console.debug || console.log || (() => {});
339
- function save(namespaces) {
340
- try {
341
- if (namespaces) {
342
- exports.storage.setItem('debug', namespaces);
343
- } else {
344
- exports.storage.removeItem('debug');
345
- }
346
- } catch (error) {}
347
- }
348
- function load() {
349
- let r;
350
- try {
351
- r = exports.storage.getItem('debug');
352
- } catch (error) {}
353
- if (!r && typeof process !== 'undefined' && ('env' in process)) {
354
- r = process.env.DEBUG;
355
- }
356
- return r;
357
- }
358
- function localstorage() {
359
- try {
360
- return localStorage;
361
- } catch (error) {}
362
- }
363
- module.exports = common(exports);
364
- const {formatters} = module.exports;
365
- formatters.j = function (v) {
366
- try {
367
- return JSON.stringify(v);
368
- } catch (error) {
369
- return '[UnexpectedJSONParseError]: ' + error.message;
370
- }
371
- };
372
- });
373
- browser.formatArgs;
374
- browser.save;
375
- browser.load;
376
- browser.useColors;
377
- browser.storage;
378
- browser.destroy;
379
- browser.colors;
380
- browser.log;
381
- browser('@pie-lib:categorize:scoring');
382
- const {clone: clone} = _dll_lodash;
383
- const {remove: remove} = _dll_lodash;
384
- const log = browser('@pie-lib:categorize');
385
- const limitInArrays = (id, arrays, limit) => {
386
- arrays = arrays || [];
387
- const result = arrays.reduce((acc, array) => {
388
- const l = limit - acc.count;
389
- const result = limitInArray(id, array, l);
390
- acc.out.push(result.array);
391
- acc.count = acc.count + (result.count || 0);
392
- return acc;
393
- }, {
394
- out: [],
395
- count: 0
396
- });
397
- return result.out;
398
- };
399
- const limitInArray = (id, arr, limit) => {
400
- arr = arr || [];
401
- if (limit === 0) {
402
- const stripped = arr.filter(v => v !== id);
403
- return {
404
- array: stripped,
405
- count: arr.length - stripped.length
406
- };
407
- } else {
408
- const result = arr.reduce((acc, v) => {
409
- if (v === id) {
410
- if (acc.count < limit) {
411
- acc.count += 1;
412
- acc.out.push(v);
413
- }
414
- } else {
415
- acc.out.push(v);
416
- }
417
- return acc;
418
- }, {
419
- out: [],
420
- count: 0
421
- });
422
- return {
423
- array: result.out,
424
- count: result.count
425
- };
426
- }
427
- };
428
- const ensureNoExtraChoicesInAnswer = (answer, choices) => {
429
- choices = choices || [];
430
- const out = choices.reduce((answerArray, choice) => {
431
- log('choice: ----> ', choice.id, 'categoryCount: ', choice.categoryCount);
432
- if (choice.categoryCount === undefined || choice.categoryCount === 0) {
433
- return answerArray;
434
- } else {
435
- const choices = answerArray.map(a => a.choices);
436
- const result = limitInArrays(choice.id, choices, choice.categoryCount);
437
- const updatedArray = result.map((r, index) => {
438
- return {
439
- category: answerArray[index].category,
440
- alternateResponses: answerArray[index].alternateResponses,
441
- choices: r
442
- };
443
- });
444
- return updatedArray;
445
- }
446
- }, answer);
447
- return out;
448
- };
449
- const countInAnswer = (choiceId, answer) => {
450
- const out = answer.reduce((acc, a) => acc + countInChoices(choiceId, a.choices), 0);
451
- log('[countInAnswer] choiceId:', choiceId, answer);
452
- return out;
453
- };
454
- const countInChoices = (choiceId, choices) => (choices || []).filter(c => c === choiceId).length;
455
- const removeCategory = (categoryId, answers) => answers.filter(a => a.category !== categoryId);
456
- const removeAllChoices = (choiceId, answers, categoryId) => {
457
- return answers.map(a => {
458
- if (!categoryId || a.category === categoryId) {
459
- const cloned = clone(a.choices);
460
- remove(cloned, v => v === choiceId);
461
- return {
462
- ...a,
463
- choices: cloned
464
- };
465
- } else {
466
- return a;
467
- }
468
- });
469
- };
470
- const removeChoiceFromCategory = (choiceId, categoryId, choiceIndex, answers) => {
471
- log('[removeChoiceFromCategory] choiceIndex:', choiceIndex);
472
- return answers.map(a => {
473
- if (a.category === categoryId) {
474
- const cloned = clone(a.choices);
475
- const index = cloned.findIndex((v, index) => {
476
- return v === choiceId && index >= choiceIndex;
477
- });
478
- if (index !== -1) {
479
- cloned.splice(index, 1);
480
- }
481
- return {
482
- ...a,
483
- choices: cloned
484
- };
485
- } else {
486
- return a;
487
- }
488
- });
489
- };
490
- const moveChoiceToCategory = (choiceId, from, to, choiceIndex, answers) => {
491
- log('[moveChoiceToCategory] choice: ', choiceId, 'from: ', from, 'to: ', to, 'answers: ', answers);
492
- if (from === to) {
493
- return answers;
494
- }
495
- if (from) {
496
- answers = removeChoiceFromCategory(choiceId, from, choiceIndex, answers);
497
- }
498
- const index = answers.findIndex(a => a.category === to);
499
- if (index === -1) {
500
- answers.push({
501
- category: to,
502
- choices: [choiceId]
503
- });
504
- return answers;
505
- } else {
506
- return answers.map(a => {
507
- if (a.category === to) {
508
- a.choices = a.choices || [];
509
- a.choices.push(choiceId);
510
- return a;
511
- }
512
- return a;
513
- });
514
- }
515
- };
516
- const React = _dll_react;
517
- const PropTypes = _dll_prop_types;
518
- const {withStyles: withStyles} = _dll_material_ui__core_styles;
519
- const EditableHtml = _dll_pie_lib__editable_html;
520
- const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/input-header.jsx";
521
- class InputHeader extends React.Component {
522
- static __initStatic() {
523
- this.propTypes = {
524
- classes: PropTypes.object.isRequired,
525
- className: PropTypes.string,
526
- label: PropTypes.string,
527
- onChange: PropTypes.func,
528
- onDelete: PropTypes.func,
529
- imageSupport: PropTypes.shape({
530
- add: PropTypes.func.isRequired,
531
- delete: PropTypes.func.isRequired
532
- })
533
- };
534
- }
535
- static __initStatic2() {
536
- this.defaultProps = {};
537
- }
538
- render() {
539
- const {onChange, label, classes, className, imageSupport} = this.props;
540
- return React.createElement('div', {
541
- className: classnames(classes.inputHeader, className),
542
- __self: this,
543
- __source: {
544
- fileName: _jsxFileName,
545
- lineNumber: 25
546
- }
547
- }, React.createElement(EditableHtml, {
548
- imageSupport: imageSupport,
549
- autoWidthToolbar: true,
550
- label: 'label',
551
- markup: label,
552
- onChange: onChange,
553
- className: classes.editor,
554
- __self: this,
555
- __source: {
556
- fileName: _jsxFileName,
557
- lineNumber: 26
558
- }
559
- }));
560
- }
561
- }
562
- InputHeader.__initStatic();
563
- InputHeader.__initStatic2();
564
- const styles = theme => ({
565
- editor: {
566
- flex: '1',
567
- paddingBottom: theme.spacing.unit
568
- },
569
- iconButtonRoot: {
570
- width: 'auto',
571
- height: 'auto'
572
- },
573
- inputHeader: {
574
- display: 'flex',
575
- justifyContent: 'space-between'
576
- }
577
- });
578
- var InputHeader$1 = withStyles(styles)(InputHeader);
579
- const React$1 = _dll_react;
580
- const PropTypes$1 = _dll_prop_types;
581
- const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
582
- const {Button: Button} = _dll_material_ui__core;
583
- const {Divider: MuiDivider} = _dll_material_ui__core;
584
- const _jsxFileName$1 = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/buttons.jsx";
585
- class RawAddButton extends React$1.Component {
586
- static __initStatic() {
587
- this.propTypes = {
588
- classes: PropTypes$1.object.isRequired,
589
- className: PropTypes$1.string,
590
- label: PropTypes$1.string,
591
- onClick: PropTypes$1.func,
592
- disabled: PropTypes$1.bool
593
- };
594
- }
595
- static __initStatic2() {
596
- this.defaultProps = {
597
- label: 'Add'
598
- };
599
- }
600
- render() {
601
- const {classes, className, label, onClick, disabled} = this.props;
602
- return React$1.createElement(Button, {
603
- onClick: onClick,
604
- disabled: disabled,
605
- className: classnames(classes.addButton, className),
606
- size: "small",
607
- variant: "contained",
608
- color: "primary",
609
- __self: this,
610
- __source: {
611
- fileName: _jsxFileName$1,
612
- lineNumber: 24
613
- }
614
- }, label);
615
- }
616
- }
617
- RawAddButton.__initStatic();
618
- RawAddButton.__initStatic2();
619
- const styles$1 = theme => ({
620
- addButton: {
621
- height: theme.spacing.unit * 4
622
- }
623
- });
624
- const AddButton = withStyles$1(styles$1)(RawAddButton);
625
- const DeleteButton = withStyles$1(() => ({
626
- deleteButton: {
627
- margin: 0,
628
- padding: 0
629
- }
630
- }))(({classes, label, onClick}) => React$1.createElement(Button, {
631
- className: classes.deleteButton,
632
- onClick: onClick,
633
- size: "small",
634
- color: "primary",
635
- __self: undefined,
636
- __source: {
637
- fileName: _jsxFileName$1,
638
- lineNumber: 51
639
- }
640
- }, label));
641
- const Divider = withStyles$1(theme => ({
642
- divider: {
643
- marginTop: 2 * theme.spacing.unit,
644
- marginBottom: 2 * theme.spacing.unit
645
- }
646
- }))(({classes}) => React$1.createElement(MuiDivider, {
647
- className: classes.divider,
648
- __self: undefined,
649
- __source: {
650
- fileName: _jsxFileName$1,
651
- lineNumber: 66
652
- }
653
- }));
654
- var interopRequireDefault = createCommonjsModule(function (module) {
655
- function _interopRequireDefault(obj) {
656
- return obj && obj.__esModule ? obj : {
657
- "default": obj
658
- };
659
- }
660
- module.exports = _interopRequireDefault;
661
- });
662
- unwrapExports(interopRequireDefault);
663
- var setPrototypeOf = createCommonjsModule(function (module) {
664
- function _setPrototypeOf(o, p) {
665
- module.exports = _setPrototypeOf = Object.setPrototypeOf || (function _setPrototypeOf(o, p) {
666
- o.__proto__ = p;
667
- return o;
668
- });
669
- return _setPrototypeOf(o, p);
670
- }
671
- module.exports = _setPrototypeOf;
672
- });
673
- function _inheritsLoose(subClass, superClass) {
674
- subClass.prototype = Object.create(superClass.prototype);
675
- subClass.prototype.constructor = subClass;
676
- setPrototypeOf(subClass, superClass);
677
- }
678
- var inheritsLoose = _inheritsLoose;
679
- var setStatic_1 = createCommonjsModule(function (module, exports) {
680
- exports.__esModule = true;
681
- exports.default = void 0;
682
- var setStatic = function setStatic(key, value) {
683
- return function (BaseComponent) {
684
- BaseComponent[key] = value;
685
- return BaseComponent;
686
- };
687
- };
688
- var _default = setStatic;
689
- exports.default = _default;
690
- });
691
- unwrapExports(setStatic_1);
692
- var setDisplayName_1 = createCommonjsModule(function (module, exports) {
693
- exports.__esModule = true;
694
- exports.default = void 0;
695
- var _setStatic = interopRequireDefault(setStatic_1);
696
- var setDisplayName = function setDisplayName(displayName) {
697
- return (0, _setStatic.default)('displayName', displayName);
698
- };
699
- var _default = setDisplayName;
700
- exports.default = _default;
701
- });
702
- unwrapExports(setDisplayName_1);
703
- var getDisplayName_1 = createCommonjsModule(function (module, exports) {
704
- exports.__esModule = true;
705
- exports.default = void 0;
706
- var getDisplayName = function getDisplayName(Component) {
707
- if (typeof Component === 'string') {
708
- return Component;
709
- }
710
- if (!Component) {
711
- return undefined;
712
- }
713
- return Component.displayName || Component.name || 'Component';
714
- };
715
- var _default = getDisplayName;
716
- exports.default = _default;
717
- });
718
- unwrapExports(getDisplayName_1);
719
- var wrapDisplayName_1 = createCommonjsModule(function (module, exports) {
720
- exports.__esModule = true;
721
- exports.default = void 0;
722
- var _getDisplayName = interopRequireDefault(getDisplayName_1);
723
- var wrapDisplayName = function wrapDisplayName(BaseComponent, hocName) {
724
- return hocName + "(" + (0, _getDisplayName.default)(BaseComponent) + ")";
725
- };
726
- var _default = wrapDisplayName;
727
- exports.default = _default;
728
- });
729
- unwrapExports(wrapDisplayName_1);
730
- const _react = _dll_react;
731
- var shouldUpdate_1 = createCommonjsModule(function (module, exports) {
732
- exports.__esModule = true;
733
- exports.default = void 0;
734
- var _inheritsLoose2 = interopRequireDefault(inheritsLoose);
735
- var _setDisplayName = interopRequireDefault(setDisplayName_1);
736
- var _wrapDisplayName = interopRequireDefault(wrapDisplayName_1);
737
- var shouldUpdate = function shouldUpdate(test) {
738
- return function (BaseComponent) {
739
- var factory = (0, _react.createFactory)(BaseComponent);
740
- var ShouldUpdate = (function (_Component) {
741
- (0, _inheritsLoose2.default)(ShouldUpdate, _Component);
742
- function ShouldUpdate() {
743
- return _Component.apply(this, arguments) || this;
744
- }
745
- var _proto = ShouldUpdate.prototype;
746
- _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
747
- return test(this.props, nextProps);
748
- };
749
- _proto.render = function render() {
750
- return factory(this.props);
751
- };
752
- return ShouldUpdate;
753
- })(_react.Component);
754
- {
755
- return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'shouldUpdate'))(ShouldUpdate);
756
- }
757
- };
758
- };
759
- var _default = shouldUpdate;
760
- exports.default = _default;
761
- });
762
- unwrapExports(shouldUpdate_1);
763
- var hasOwnProperty = Object.prototype.hasOwnProperty;
764
- function is(x, y) {
765
- if (x === y) {
766
- return x !== 0 || y !== 0 || 1 / x === 1 / y;
767
- } else {
768
- return x !== x && y !== y;
769
- }
770
- }
771
- function shallowEqual(objA, objB) {
772
- if (is(objA, objB)) {
773
- return true;
774
- }
775
- if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
776
- return false;
777
- }
778
- var keysA = Object.keys(objA);
779
- var keysB = Object.keys(objB);
780
- if (keysA.length !== keysB.length) {
781
- return false;
782
- }
783
- for (var i = 0; i < keysA.length; i++) {
784
- if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
785
- return false;
786
- }
787
- }
788
- return true;
789
- }
790
- var shallowEqual_1 = shallowEqual;
791
- var shallowEqual$1 = createCommonjsModule(function (module, exports) {
792
- exports.__esModule = true;
793
- exports.default = void 0;
794
- var _shallowEqual = interopRequireDefault(shallowEqual_1);
795
- var _default = _shallowEqual.default;
796
- exports.default = _default;
797
- });
798
- unwrapExports(shallowEqual$1);
799
- var pure_1 = createCommonjsModule(function (module, exports) {
800
- exports.__esModule = true;
801
- exports.default = void 0;
802
- var _shouldUpdate = interopRequireDefault(shouldUpdate_1);
803
- var _shallowEqual = interopRequireDefault(shallowEqual$1);
804
- var _setDisplayName = interopRequireDefault(setDisplayName_1);
805
- var _wrapDisplayName = interopRequireDefault(wrapDisplayName_1);
806
- var pure = function pure(BaseComponent) {
807
- var hoc = (0, _shouldUpdate.default)(function (props, nextProps) {
808
- return !(0, _shallowEqual.default)(props, nextProps);
809
- });
810
- {
811
- return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'pure'))(hoc(BaseComponent));
812
- }
813
- };
814
- var _default = pure;
815
- exports.default = _default;
816
- });
817
- unwrapExports(pure_1);
818
- const require$$0 = _dll_react;
819
- const {SvgIcon: require$$2} = _dll_material_ui__core;
820
- var createSvgIcon_1 = createCommonjsModule(function (module, exports) {
821
- Object.defineProperty(exports, "__esModule", {
822
- value: true
823
- });
824
- exports.default = void 0;
825
- var _react = interopRequireDefault(require$$0);
826
- var _pure = interopRequireDefault(pure_1);
827
- var _SvgIcon = interopRequireDefault(require$$2);
828
- function createSvgIcon(path, displayName) {
829
- var Icon = function Icon(props) {
830
- return _react.default.createElement(_SvgIcon.default, props, path);
831
- };
832
- Icon.displayName = ("").concat(displayName, "Icon");
833
- Icon = (0, _pure.default)(Icon);
834
- Icon.muiName = 'SvgIcon';
835
- return Icon;
836
- }
837
- var _default = createSvgIcon;
838
- exports.default = _default;
839
- });
840
- unwrapExports(createSvgIcon_1);
841
- const require$$0$1 = _dll_react;
842
- var Delete = createCommonjsModule(function (module, exports) {
843
- Object.defineProperty(exports, "__esModule", {
844
- value: true
845
- });
846
- exports.default = void 0;
847
- var _react = interopRequireDefault(require$$0$1);
848
- var _createSvgIcon = interopRequireDefault(createSvgIcon_1);
849
- var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
850
- d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
851
- }), _react.default.createElement("path", {
852
- fill: "none",
853
- d: "M0 0h24v24H0z"
854
- })), 'Delete');
855
- exports.default = _default;
856
- });
857
- var Delete$1 = unwrapExports(Delete);
858
- const React$2 = _dll_react;
859
- const PropTypes$2 = _dll_prop_types;
860
- const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
861
- const {Choice: Choice} = _dll_pie_lib__drag;
862
- const {IconButton: IconButton} = _dll_material_ui__core;
863
- const {HtmlAndMath: HtmlAndMath} = _dll_pie_lib__render_ui;
864
- const _jsxFileName$2 = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/categories/choice-preview.jsx";
865
- class ChoicePreview extends React$2.Component {
866
- constructor(...args) {
867
- super(...args);
868
- ChoicePreview.prototype.__init.call(this);
869
- }
870
- static __initStatic() {
871
- this.propTypes = {
872
- classes: PropTypes$2.object.isRequired,
873
- className: PropTypes$2.string,
874
- choice: PropTypes$2.object.isRequired,
875
- onDelete: PropTypes$2.func.isRequired
876
- };
877
- }
878
- static __initStatic2() {
879
- this.defaultProps = {};
880
- }
881
- __init() {
882
- this.delete = () => {
883
- const {onDelete, choice} = this.props;
884
- onDelete(choice);
885
- };
886
- }
887
- render() {
888
- const {classes, className, choice} = this.props;
889
- return React$2.createElement('div', {
890
- className: classnames(classes.choicePreview, className),
891
- __self: this,
892
- __source: {
893
- fileName: _jsxFileName$2,
894
- lineNumber: 27
895
- }
896
- }, React$2.createElement(Choice, {
897
- __self: this,
898
- __source: {
899
- fileName: _jsxFileName$2,
900
- lineNumber: 28
901
- }
902
- }, React$2.createElement(HtmlAndMath, {
903
- html: choice.content,
904
- __self: this,
905
- __source: {
906
- fileName: _jsxFileName$2,
907
- lineNumber: 29
908
- }
909
- }), React$2.createElement(IconButton, {
910
- color: "secondary",
911
- 'aria-label': "delete",
912
- className: classes.delete,
913
- onClick: this.delete,
914
- __self: this,
915
- __source: {
916
- fileName: _jsxFileName$2,
917
- lineNumber: 30
918
- }
919
- }, React$2.createElement(Delete$1, {
920
- __self: this,
921
- __source: {
922
- fileName: _jsxFileName$2,
923
- lineNumber: 36
924
- }
925
- }))));
926
- }
927
- }
928
- ChoicePreview.__initStatic();
929
- ChoicePreview.__initStatic2();
930
- const styles$2 = () => ({
931
- choicePreview: {
932
- position: 'relative'
933
- },
934
- delete: {
935
- position: 'absolute',
936
- right: 0,
937
- top: 0
938
- }
939
- });
940
- var ChoicePreview$1 = withStyles$2(styles$2)(ChoicePreview);
941
- var s$1 = 1000;
942
- var m$1 = s$1 * 60;
943
- var h$1 = m$1 * 60;
944
- var d$1 = h$1 * 24;
945
- var w$1 = d$1 * 7;
946
- var y$1 = d$1 * 365.25;
947
- var ms$1 = function (val, options) {
948
- options = options || ({});
949
- var type = typeof val;
950
- if (type === 'string' && val.length > 0) {
951
- return parse$1(val);
952
- } else if (type === 'number' && isFinite(val)) {
953
- return options.long ? fmtLong$1(val) : fmtShort$1(val);
954
- }
955
- throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
956
- };
957
- function parse$1(str) {
958
- str = String(str);
959
- if (str.length > 100) {
960
- return;
961
- }
962
- 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);
963
- if (!match) {
964
- return;
965
- }
966
- var n = parseFloat(match[1]);
967
- var type = (match[2] || 'ms').toLowerCase();
968
- switch (type) {
969
- case 'years':
970
- case 'year':
971
- case 'yrs':
972
- case 'yr':
973
- case 'y':
974
- return n * y$1;
975
- case 'weeks':
976
- case 'week':
977
- case 'w':
978
- return n * w$1;
979
- case 'days':
980
- case 'day':
981
- case 'd':
982
- return n * d$1;
983
- case 'hours':
984
- case 'hour':
985
- case 'hrs':
986
- case 'hr':
987
- case 'h':
988
- return n * h$1;
989
- case 'minutes':
990
- case 'minute':
991
- case 'mins':
992
- case 'min':
993
- case 'm':
994
- return n * m$1;
995
- case 'seconds':
996
- case 'second':
997
- case 'secs':
998
- case 'sec':
999
- case 's':
1000
- return n * s$1;
1001
- case 'milliseconds':
1002
- case 'millisecond':
1003
- case 'msecs':
1004
- case 'msec':
1005
- case 'ms':
1006
- return n;
1007
- default:
1008
- return undefined;
1009
- }
1010
- }
1011
- function fmtShort$1(ms) {
1012
- var msAbs = Math.abs(ms);
1013
- if (msAbs >= d$1) {
1014
- return Math.round(ms / d$1) + 'd';
1015
- }
1016
- if (msAbs >= h$1) {
1017
- return Math.round(ms / h$1) + 'h';
1018
- }
1019
- if (msAbs >= m$1) {
1020
- return Math.round(ms / m$1) + 'm';
1021
- }
1022
- if (msAbs >= s$1) {
1023
- return Math.round(ms / s$1) + 's';
1024
- }
1025
- return ms + 'ms';
1026
- }
1027
- function fmtLong$1(ms) {
1028
- var msAbs = Math.abs(ms);
1029
- if (msAbs >= d$1) {
1030
- return plural$1(ms, msAbs, d$1, 'day');
1031
- }
1032
- if (msAbs >= h$1) {
1033
- return plural$1(ms, msAbs, h$1, 'hour');
1034
- }
1035
- if (msAbs >= m$1) {
1036
- return plural$1(ms, msAbs, m$1, 'minute');
1037
- }
1038
- if (msAbs >= s$1) {
1039
- return plural$1(ms, msAbs, s$1, 'second');
1040
- }
1041
- return ms + ' ms';
1042
- }
1043
- function plural$1(ms, msAbs, n, name) {
1044
- var isPlural = msAbs >= n * 1.5;
1045
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
1046
- }
1047
- function setup$1(env) {
1048
- createDebug.debug = createDebug;
1049
- createDebug.default = createDebug;
1050
- createDebug.coerce = coerce;
1051
- createDebug.disable = disable;
1052
- createDebug.enable = enable;
1053
- createDebug.enabled = enabled;
1054
- createDebug.humanize = ms$1;
1055
- Object.keys(env).forEach(function (key) {
1056
- createDebug[key] = env[key];
1057
- });
1058
- createDebug.instances = [];
1059
- createDebug.names = [];
1060
- createDebug.skips = [];
1061
- createDebug.formatters = {};
1062
- function selectColor(namespace) {
1063
- var hash = 0;
1064
- for (var i = 0; i < namespace.length; i++) {
1065
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
1066
- hash |= 0;
1067
- }
1068
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
1069
- }
1070
- createDebug.selectColor = selectColor;
1071
- function createDebug(namespace) {
1072
- var prevTime;
1073
- function debug() {
1074
- if (!debug.enabled) {
1075
- return;
1076
- }
1077
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1078
- args[_key] = arguments[_key];
1079
- }
1080
- var self = debug;
1081
- var curr = Number(new Date());
1082
- var ms = curr - (prevTime || curr);
1083
- self.diff = ms;
1084
- self.prev = prevTime;
1085
- self.curr = curr;
1086
- prevTime = curr;
1087
- args[0] = createDebug.coerce(args[0]);
1088
- if (typeof args[0] !== 'string') {
1089
- args.unshift('%O');
1090
- }
1091
- var index = 0;
1092
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
1093
- if (match === '%%') {
1094
- return match;
1095
- }
1096
- index++;
1097
- var formatter = createDebug.formatters[format];
1098
- if (typeof formatter === 'function') {
1099
- var val = args[index];
1100
- match = formatter.call(self, val);
1101
- args.splice(index, 1);
1102
- index--;
1103
- }
1104
- return match;
1105
- });
1106
- createDebug.formatArgs.call(self, args);
1107
- var logFn = self.log || createDebug.log;
1108
- logFn.apply(self, args);
1109
- }
1110
- debug.namespace = namespace;
1111
- debug.enabled = createDebug.enabled(namespace);
1112
- debug.useColors = createDebug.useColors();
1113
- debug.color = selectColor(namespace);
1114
- debug.destroy = destroy;
1115
- debug.extend = extend;
1116
- if (typeof createDebug.init === 'function') {
1117
- createDebug.init(debug);
1118
- }
1119
- createDebug.instances.push(debug);
1120
- return debug;
1121
- }
1122
- function destroy() {
1123
- var index = createDebug.instances.indexOf(this);
1124
- if (index !== -1) {
1125
- createDebug.instances.splice(index, 1);
1126
- return true;
1127
- }
1128
- return false;
1129
- }
1130
- function extend(namespace, delimiter) {
1131
- return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
1132
- }
1133
- function enable(namespaces) {
1134
- createDebug.save(namespaces);
1135
- createDebug.names = [];
1136
- createDebug.skips = [];
1137
- var i;
1138
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
1139
- var len = split.length;
1140
- for (i = 0; i < len; i++) {
1141
- if (!split[i]) {
1142
- continue;
1143
- }
1144
- namespaces = split[i].replace(/\*/g, '.*?');
1145
- if (namespaces[0] === '-') {
1146
- createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
1147
- } else {
1148
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
1149
- }
1150
- }
1151
- for (i = 0; i < createDebug.instances.length; i++) {
1152
- var instance = createDebug.instances[i];
1153
- instance.enabled = createDebug.enabled(instance.namespace);
1154
- }
1155
- }
1156
- function disable() {
1157
- createDebug.enable('');
1158
- }
1159
- function enabled(name) {
1160
- if (name[name.length - 1] === '*') {
1161
- return true;
1162
- }
1163
- var i;
1164
- var len;
1165
- for ((i = 0, len = createDebug.skips.length); i < len; i++) {
1166
- if (createDebug.skips[i].test(name)) {
1167
- return false;
1168
- }
1169
- }
1170
- for ((i = 0, len = createDebug.names.length); i < len; i++) {
1171
- if (createDebug.names[i].test(name)) {
1172
- return true;
1173
- }
1174
- }
1175
- return false;
1176
- }
1177
- function coerce(val) {
1178
- if (val instanceof Error) {
1179
- return val.stack || val.message;
1180
- }
1181
- return val;
1182
- }
1183
- createDebug.enable(createDebug.load());
1184
- return createDebug;
1185
- }
1186
- var common$1 = setup$1;
1187
- var browser$1 = createCommonjsModule(function (module, exports) {
1188
- function _typeof(obj) {
1189
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1190
- _typeof = function _typeof(obj) {
1191
- return typeof obj;
1192
- };
1193
- } else {
1194
- _typeof = function _typeof(obj) {
1195
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1196
- };
1197
- }
1198
- return _typeof(obj);
1199
- }
1200
- exports.log = log;
1201
- exports.formatArgs = formatArgs;
1202
- exports.save = save;
1203
- exports.load = load;
1204
- exports.useColors = useColors;
1205
- exports.storage = localstorage();
1206
- 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'];
1207
- function useColors() {
1208
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
1209
- return true;
1210
- }
1211
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
1212
- return false;
1213
- }
1214
- 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+)/);
1215
- }
1216
- function formatArgs(args) {
1217
- args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
1218
- if (!this.useColors) {
1219
- return;
1220
- }
1221
- var c = 'color: ' + this.color;
1222
- args.splice(1, 0, c, 'color: inherit');
1223
- var index = 0;
1224
- var lastC = 0;
1225
- args[0].replace(/%[a-zA-Z%]/g, function (match) {
1226
- if (match === '%%') {
1227
- return;
1228
- }
1229
- index++;
1230
- if (match === '%c') {
1231
- lastC = index;
1232
- }
1233
- });
1234
- args.splice(lastC, 0, c);
1235
- }
1236
- function log() {
1237
- var _console;
1238
- return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
1239
- }
1240
- function save(namespaces) {
1241
- try {
1242
- if (namespaces) {
1243
- exports.storage.setItem('debug', namespaces);
1244
- } else {
1245
- exports.storage.removeItem('debug');
1246
- }
1247
- } catch (error) {}
1248
- }
1249
- function load() {
1250
- var r;
1251
- try {
1252
- r = exports.storage.getItem('debug');
1253
- } catch (error) {}
1254
- if (!r && typeof process !== 'undefined' && ('env' in process)) {
1255
- r = process.env.DEBUG;
1256
- }
1257
- return r;
1258
- }
1259
- function localstorage() {
1260
- try {
1261
- return localStorage;
1262
- } catch (error) {}
1263
- }
1264
- module.exports = common$1(exports);
1265
- var formatters = module.exports.formatters;
1266
- formatters.j = function (v) {
1267
- try {
1268
- return JSON.stringify(v);
1269
- } catch (error) {
1270
- return '[UnexpectedJSONParseError]: ' + error.message;
1271
- }
1272
- };
1273
- });
1274
- browser$1.log;
1275
- browser$1.formatArgs;
1276
- browser$1.save;
1277
- browser$1.load;
1278
- browser$1.useColors;
1279
- browser$1.storage;
1280
- browser$1.colors;
1281
- const React$3 = _dll_react;
1282
- const PropTypes$3 = _dll_prop_types;
1283
- const {withStyles: withStyles$3} = _dll_material_ui__core_styles;
1284
- const {DropTarget: DropTarget} = _dll_react_dnd;
1285
- const {uid: uid} = _dll_pie_lib__drag;
1286
- const {PlaceHolder: PlaceHolder} = _dll_pie_lib__drag;
1287
- const _jsxFileName$3 = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/categories/droppable-placeholder.jsx";
1288
- const log$1 = browser$1('@pie-element:categorize:configure');
1289
- const Helper = withStyles$3(() => ({
1290
- helper: {
1291
- display: 'flex',
1292
- alignItems: 'center',
1293
- fontSize: '12px',
1294
- color: 'rgba(0,0,0,0.4)',
1295
- width: '100%',
1296
- height: '100%'
1297
- }
1298
- }))(({classes}) => React$3.createElement('div', {
1299
- className: classes.helper,
1300
- __self: undefined,
1301
- __source: {
1302
- fileName: _jsxFileName$3,
1303
- lineNumber: 22
1304
- }
1305
- }, "Drag your correct answers here"));
1306
- const Previews = ({choices, onDeleteChoice}) => React$3.createElement(React$3.Fragment, {
1307
- __self: undefined,
1308
- __source: {
1309
- fileName: _jsxFileName$3,
1310
- lineNumber: 26
1311
- }
1312
- }, choices.map((c, index) => React$3.createElement(ChoicePreview$1, {
1313
- choice: c,
1314
- key: index,
1315
- onDelete: choice => onDeleteChoice(choice, index),
1316
- __self: undefined,
1317
- __source: {
1318
- fileName: _jsxFileName$3,
1319
- lineNumber: 28
1320
- }
1321
- })));
1322
- Previews.propTypes = {
1323
- choices: PropTypes$3.array,
1324
- onDeleteChoice: PropTypes$3.func
1325
- };
1326
- class DroppablePlaceHolder extends React$3.Component {
1327
- static __initStatic() {
1328
- this.propTypes = {
1329
- classes: PropTypes$3.object.isRequired,
1330
- className: PropTypes$3.string,
1331
- connectDropTarget: PropTypes$3.func.isRequired,
1332
- choices: PropTypes$3.array,
1333
- onDropChoice: PropTypes$3.func.isRequired,
1334
- isOver: PropTypes$3.bool,
1335
- onDeleteChoice: PropTypes$3.func,
1336
- categoryId: PropTypes$3.string.isRequired
1337
- };
1338
- }
1339
- static __initStatic2() {
1340
- this.defaultProps = {};
1341
- }
1342
- render() {
1343
- const {isOver, choices, classes, className, connectDropTarget, onDeleteChoice} = this.props;
1344
- return connectDropTarget(React$3.createElement('div', {
1345
- className: classnames(classes.droppablePlaceholder, className),
1346
- __self: this,
1347
- __source: {
1348
- fileName: _jsxFileName$3,
1349
- lineNumber: 66
1350
- }
1351
- }, React$3.createElement(PlaceHolder, {
1352
- isOver: isOver,
1353
- className: classes.placeHolder,
1354
- __self: this,
1355
- __source: {
1356
- fileName: _jsxFileName$3,
1357
- lineNumber: 67
1358
- }
1359
- }, (choices || []).length === 0 ? React$3.createElement(Helper, {
1360
- __self: this,
1361
- __source: {
1362
- fileName: _jsxFileName$3,
1363
- lineNumber: 69
1364
- }
1365
- }) : React$3.createElement(Previews, {
1366
- choices: choices,
1367
- onDeleteChoice: onDeleteChoice,
1368
- __self: this,
1369
- __source: {
1370
- fileName: _jsxFileName$3,
1371
- lineNumber: 71
1372
- }
1373
- }))));
1374
- }
1375
- }
1376
- DroppablePlaceHolder.__initStatic();
1377
- DroppablePlaceHolder.__initStatic2();
1378
- const styles$3 = () => ({
1379
- droppablePlaceholder: {
1380
- minHeight: '100px'
1381
- },
1382
- placeHolder: {
1383
- width: '100%',
1384
- minHeight: '100px',
1385
- height: 'auto'
1386
- }
1387
- });
1388
- const Styled = withStyles$3(styles$3)(DroppablePlaceHolder);
1389
- const spec = {
1390
- drop: (props, monitor) => {
1391
- log$1('[drop] props: ', props);
1392
- const item = monitor.getItem();
1393
- props.onDropChoice(item, props.categoryId);
1394
- },
1395
- canDrop: props => {
1396
- return !props.disabled;
1397
- }
1398
- };
1399
- const WithTarget = DropTarget(({uid}) => uid, spec, (connect, monitor) => ({
1400
- connectDropTarget: connect.dropTarget(),
1401
- isOver: monitor.isOver()
1402
- }))(Styled);
1403
- var PlaceHolder$1 = uid.withUid(WithTarget);
1404
- const React$4 = _dll_react;
1405
- const PropTypes$4 = _dll_prop_types;
1406
- const {withStyles: withStyles$4} = _dll_material_ui__core_styles;
1407
- const {Card: Card} = _dll_material_ui__core;
1408
- const {CardActions: CardActions} = _dll_material_ui__core;
1409
- const _jsxFileName$4 = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/categories/category.jsx";
1410
- class Category extends React$4.Component {
1411
- constructor(...args) {
1412
- super(...args);
1413
- Category.prototype.__init.call(this);
1414
- }
1415
- static __initStatic() {
1416
- this.propTypes = {
1417
- classes: PropTypes$4.object.isRequired,
1418
- className: PropTypes$4.string,
1419
- category: PropTypes$4.object.isRequired,
1420
- onChange: PropTypes$4.func,
1421
- onDelete: PropTypes$4.func,
1422
- onDeleteChoice: PropTypes$4.func,
1423
- onAddChoice: PropTypes$4.func,
1424
- imageSupport: PropTypes$4.shape({
1425
- add: PropTypes$4.func.isRequired,
1426
- delete: PropTypes$4.func.isRequired
1427
- })
1428
- };
1429
- }
1430
- static __initStatic2() {
1431
- this.defaultProps = {};
1432
- }
1433
- __init() {
1434
- this.changeLabel = l => {
1435
- const {category, onChange} = this.props;
1436
- category.label = l;
1437
- onChange(category);
1438
- };
1439
- }
1440
- render() {
1441
- const {category, classes, className, onChange, onDelete, onDeleteChoice, onAddChoice, imageSupport} = this.props;
1442
- return React$4.createElement(Card, {
1443
- className: classnames(classes.category, className),
1444
- __self: this,
1445
- __source: {
1446
- fileName: _jsxFileName$4,
1447
- lineNumber: 48
1448
- }
1449
- }, onChange && React$4.createElement(InputHeader$1, {
1450
- label: category.label,
1451
- onChange: this.changeLabel,
1452
- onDelete: onDelete,
1453
- imageSupport: imageSupport,
1454
- __self: this,
1455
- __source: {
1456
- fileName: _jsxFileName$4,
1457
- lineNumber: 51
1458
- }
1459
- }), React$4.createElement(PlaceHolder$1, {
1460
- className: classes.placeHolder,
1461
- choices: category.choices,
1462
- onDeleteChoice: onDeleteChoice,
1463
- onDropChoice: onAddChoice,
1464
- categoryId: category.id,
1465
- __self: this,
1466
- __source: {
1467
- fileName: _jsxFileName$4,
1468
- lineNumber: 59
1469
- }
1470
- }), onDelete && React$4.createElement(CardActions, {
1471
- className: classes.actions,
1472
- __self: this,
1473
- __source: {
1474
- fileName: _jsxFileName$4,
1475
- lineNumber: 68
1476
- }
1477
- }, React$4.createElement(DeleteButton, {
1478
- label: 'delete',
1479
- onClick: onDelete,
1480
- __self: this,
1481
- __source: {
1482
- fileName: _jsxFileName$4,
1483
- lineNumber: 69
1484
- }
1485
- })));
1486
- }
1487
- }
1488
- Category.__initStatic();
1489
- Category.__initStatic2();
1490
- const styles$4 = theme => ({
1491
- placeHolder: {
1492
- minHeight: '100px'
1493
- },
1494
- deleteButton: {
1495
- margin: 0
1496
- },
1497
- actions: {
1498
- padding: 0,
1499
- paddingBottom: 0,
1500
- paddingTop: theme.spacing.unit
1501
- },
1502
- iconButtonRoot: {
1503
- width: 'auto',
1504
- height: 'auto'
1505
- },
1506
- header: {
1507
- display: 'flex',
1508
- justifyContent: 'space-between'
1509
- },
1510
- category: {
1511
- padding: theme.spacing.unit,
1512
- overflow: 'visible'
1513
- },
1514
- editor: {
1515
- flex: '1',
1516
- paddingBottom: theme.spacing.unit * 2
1517
- }
1518
- });
1519
- var Category$1 = withStyles$4(styles$4)(Category);
1520
- const React$5 = _dll_react;
1521
- const PropTypes$5 = _dll_prop_types;
1522
- const {Typography: Typography} = _dll_material_ui__core;
1523
- const {withStyles: withStyles$5} = _dll_material_ui__core_styles;
1524
- const _jsxFileName$5 = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/header.jsx";
1525
- class Header extends React$5.Component {
1526
- static __initStatic() {
1527
- this.propTypes = {
1528
- classes: PropTypes$5.object.isRequired,
1529
- className: PropTypes$5.string,
1530
- buttonLabel: PropTypes$5.string,
1531
- onAdd: PropTypes$5.func.isRequired,
1532
- label: PropTypes$5.string.isRequired
1533
- };
1534
- }
1535
- static __initStatic2() {
1536
- this.defaultProps = {};
1537
- }
1538
- render() {
1539
- const {classes, className, onAdd, label, buttonLabel} = this.props;
1540
- return React$5.createElement('div', {
1541
- className: classnames(classes.header, className),
1542
- __self: this,
1543
- __source: {
1544
- fileName: _jsxFileName$5,
1545
- lineNumber: 21
1546
- }
1547
- }, React$5.createElement(Typography, {
1548
- variant: "title",
1549
- className: classes.title,
1550
- __self: this,
1551
- __source: {
1552
- fileName: _jsxFileName$5,
1553
- lineNumber: 22
1554
- }
1555
- }, label), React$5.createElement(AddButton, {
1556
- onClick: onAdd,
1557
- label: buttonLabel,
1558
- __self: this,
1559
- __source: {
1560
- fileName: _jsxFileName$5,
1561
- lineNumber: 25
1562
- }
1563
- }));
1564
- }
1565
- }
1566
- Header.__initStatic();
1567
- Header.__initStatic2();
1568
- const styles$5 = theme => ({
1569
- header: {
1570
- display: 'flex',
1571
- justifyContent: 'space-between',
1572
- marginBottom: 2 * theme.spacing.unit
1573
- }
1574
- });
1575
- var Header$1 = withStyles$5(styles$5)(Header);
1576
- const React$6 = _dll_react;
1577
- const PropTypes$6 = _dll_prop_types;
1578
- const {withStyles: withStyles$6} = _dll_material_ui__core_styles;
1579
- const {TextField: TextField} = _dll_material_ui__core;
1580
- const {Typography: Typography$1} = _dll_material_ui__core;
1581
- const {choiceUtils: utils} = _dll_pie_lib__config_ui;
1582
- const EditableHtml$1 = _dll_pie_lib__editable_html;
1583
- const _jsxFileName$6 = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/categories/index.jsx";
1584
- const styles$6 = theme => ({
1585
- categories: {
1586
- marginBottom: theme.spacing.unit
1587
- },
1588
- categoriesHolder: {
1589
- display: 'grid',
1590
- gridRowGap: `${theme.spacing.unit}px`,
1591
- gridColumnGap: `${theme.spacing.unit}px`
1592
- },
1593
- row: {
1594
- display: 'grid',
1595
- gridTemplateColumns: 'repeat(2, 1fr)',
1596
- gridColumnGap: `${theme.spacing.unit}px`,
1597
- alignItems: 'baseline',
1598
- width: '100%',
1599
- marginTop: theme.spacing.unit,
1600
- marginBottom: 2 * theme.spacing.unit
1601
- },
1602
- rowLabel: {
1603
- gridColumn: '1/3'
1604
- },
1605
- rowLabelHolder: {
1606
- width: '100%'
1607
- }
1608
- });
1609
- const RowLabel = withStyles$6(styles$6)(({categoriesPerRow, classes, markup, imageSupport, onChange}) => {
1610
- return React$6.createElement('div', {
1611
- style: {
1612
- gridColumn: `1/${categoriesPerRow + 1}`,
1613
- width: '100%'
1614
- },
1615
- __self: undefined,
1616
- __source: {
1617
- fileName: _jsxFileName$6,
1618
- lineNumber: 41
1619
- }
1620
- }, React$6.createElement(Typography$1, {
1621
- className: classes.text,
1622
- __self: undefined,
1623
- __source: {
1624
- fileName: _jsxFileName$6,
1625
- lineNumber: 47
1626
- }
1627
- }, "Row Label"), React$6.createElement(EditableHtml$1, {
1628
- className: classes.rowLabelHolder,
1629
- markup: markup,
1630
- onChange: onChange,
1631
- imageSupport: imageSupport,
1632
- nonEmpty: false,
1633
- __self: undefined,
1634
- __source: {
1635
- fileName: _jsxFileName$6,
1636
- lineNumber: 50
1637
- }
1638
- }));
1639
- });
1640
- class Categories extends React$6.Component {
1641
- constructor(...args) {
1642
- super(...args);
1643
- Categories.prototype.__init.call(this);
1644
- Categories.prototype.__init2.call(this);
1645
- Categories.prototype.__init3.call(this);
1646
- Categories.prototype.__init4.call(this);
1647
- Categories.prototype.__init5.call(this);
1648
- Categories.prototype.__init6.call(this);
1649
- Categories.prototype.__init7.call(this);
1650
- }
1651
- static __initStatic() {
1652
- this.propTypes = {
1653
- imageSupport: PropTypes$6.shape({
1654
- add: PropTypes$6.func.isRequired,
1655
- delete: PropTypes$6.func.isRequired
1656
- }),
1657
- classes: PropTypes$6.object.isRequired,
1658
- className: PropTypes$6.string,
1659
- categories: PropTypes$6.array,
1660
- onModelChanged: PropTypes$6.func,
1661
- model: PropTypes$6.object.isRequired
1662
- };
1663
- }
1664
- __init() {
1665
- this.changeCategoryColumns = event => {
1666
- const numberValue = parseInt(event.target.value, 10);
1667
- if (numberValue && numberValue >= 1 && numberValue <= 4) {
1668
- this.props.onModelChanged({
1669
- categoriesPerRow: numberValue
1670
- });
1671
- }
1672
- };
1673
- }
1674
- __init2() {
1675
- this.add = () => {
1676
- const {model} = this.props;
1677
- const {categoriesPerRow} = model;
1678
- const id = utils.firstAvailableIndex(model.categories.map(a => a.id), 0);
1679
- const data = {
1680
- id,
1681
- label: 'Category ' + id
1682
- };
1683
- const addRowLabel = model.categories.length % categoriesPerRow === 0;
1684
- const rowLabels = [...model.rowLabels];
1685
- if (addRowLabel) {
1686
- rowLabels.push('');
1687
- }
1688
- this.props.onModelChanged({
1689
- rowLabels,
1690
- categories: model.categories.concat([data])
1691
- });
1692
- };
1693
- }
1694
- __init3() {
1695
- this.delete = category => {
1696
- const {model, onModelChanged} = this.props;
1697
- const index = model.categories.findIndex(a => a.id === category.id);
1698
- if (index !== -1) {
1699
- model.categories.splice(index, 1);
1700
- model.correctResponse = removeCategory(category.id, model.correctResponse);
1701
- onModelChanged(model);
1702
- }
1703
- };
1704
- }
1705
- __init4() {
1706
- this.change = c => {
1707
- const {categories} = this.props;
1708
- const index = categories.findIndex(a => a.id === c.id);
1709
- if (index !== -1) {
1710
- categories.splice(index, 1, c);
1711
- this.props.onModelChanged({
1712
- categories
1713
- });
1714
- }
1715
- };
1716
- }
1717
- __init5() {
1718
- this.addChoiceToCategory = (choice, categoryId) => {
1719
- const {model, onModelChanged} = this.props;
1720
- const correctResponse = moveChoiceToCategory(choice.id, undefined, categoryId, 0, model.correctResponse);
1721
- onModelChanged({
1722
- correctResponse
1723
- });
1724
- };
1725
- }
1726
- __init6() {
1727
- this.deleteChoiceFromCategory = (category, choice, choiceIndex) => {
1728
- const {model, onModelChanged} = this.props;
1729
- const correctResponse = removeChoiceFromCategory(choice.id, category.id, choiceIndex, model.correctResponse);
1730
- onModelChanged({
1731
- correctResponse
1732
- });
1733
- };
1734
- }
1735
- __init7() {
1736
- this.changeRowLabel = (val, index) => {
1737
- const {model} = this.props;
1738
- const {rowLabels} = model;
1739
- const newRowLabels = [...rowLabels];
1740
- if (newRowLabels.length < index) {
1741
- newRowLabels.push(val);
1742
- } else {
1743
- newRowLabels[index] = val;
1744
- }
1745
- this.props.onModelChanged({
1746
- rowLabels: newRowLabels
1747
- });
1748
- };
1749
- }
1750
- render() {
1751
- const {model, classes, className, categories, imageSupport} = this.props;
1752
- const {categoriesPerRow, rowLabels} = model;
1753
- const holderStyle = {
1754
- gridTemplateColumns: `repeat(${categoriesPerRow}, 1fr)`
1755
- };
1756
- const lastRowLabelIndex = parseInt((categories.length - 1) / categoriesPerRow);
1757
- return React$6.createElement('div', {
1758
- className: classnames(classes.categories, className),
1759
- __self: this,
1760
- __source: {
1761
- fileName: _jsxFileName$6,
1762
- lineNumber: 181
1763
- }
1764
- }, React$6.createElement(Header$1, {
1765
- label: "Categories",
1766
- buttonLabel: "ADD A CATEGORY",
1767
- onAdd: this.add,
1768
- __self: this,
1769
- __source: {
1770
- fileName: _jsxFileName$6,
1771
- lineNumber: 182
1772
- }
1773
- }), React$6.createElement('div', {
1774
- className: classes.row,
1775
- __self: this,
1776
- __source: {
1777
- fileName: _jsxFileName$6,
1778
- lineNumber: 183
1779
- }
1780
- }, React$6.createElement(TextField, {
1781
- label: "Categories per row",
1782
- type: "number",
1783
- inputProps: {
1784
- min: 1,
1785
- max: 4
1786
- },
1787
- value: categoriesPerRow,
1788
- onChange: this.changeCategoryColumns,
1789
- __self: this,
1790
- __source: {
1791
- fileName: _jsxFileName$6,
1792
- lineNumber: 184
1793
- }
1794
- })), React$6.createElement('div', {
1795
- className: classes.categoriesHolder,
1796
- style: holderStyle,
1797
- __self: this,
1798
- __source: {
1799
- fileName: _jsxFileName$6,
1800
- lineNumber: 195
1801
- }
1802
- }, categories.map((category, index) => {
1803
- const hasRowLabel = index > 1 && index % categoriesPerRow === 0;
1804
- const rowIndex = parseInt(index / (categoriesPerRow + 1));
1805
- return React$6.createElement(React$6.Fragment, {
1806
- key: index,
1807
- __self: this,
1808
- __source: {
1809
- fileName: _jsxFileName$6,
1810
- lineNumber: 201
1811
- }
1812
- }, hasRowLabel && React$6.createElement(RowLabel, {
1813
- categoriesPerRow: categoriesPerRow,
1814
- rowIndex: rowIndex,
1815
- markup: rowLabels[rowIndex] || '',
1816
- onChange: val => this.changeRowLabel(val, rowIndex),
1817
- imageSupport: imageSupport,
1818
- __self: this,
1819
- __source: {
1820
- fileName: _jsxFileName$6,
1821
- lineNumber: 206
1822
- }
1823
- }), React$6.createElement(Category$1, {
1824
- imageSupport: imageSupport,
1825
- category: category,
1826
- onChange: this.change,
1827
- onDelete: () => this.delete(category),
1828
- onAddChoice: this.addChoiceToCategory,
1829
- onDeleteChoice: (choice, choiceIndex) => this.deleteChoiceFromCategory(category, choice, choiceIndex),
1830
- __self: this,
1831
- __source: {
1832
- fileName: _jsxFileName$6,
1833
- lineNumber: 215
1834
- }
1835
- }));
1836
- }), React$6.createElement(RowLabel, {
1837
- categoriesPerRow: categoriesPerRow,
1838
- rowIndex: lastRowLabelIndex,
1839
- markup: rowLabels[lastRowLabelIndex] || '',
1840
- onChange: val => this.changeRowLabel(val, lastRowLabelIndex),
1841
- imageSupport: imageSupport,
1842
- __self: this,
1843
- __source: {
1844
- fileName: _jsxFileName$6,
1845
- lineNumber: 228
1846
- }
1847
- })));
1848
- }
1849
- }
1850
- Categories.__initStatic();
1851
- var Categories$1 = withStyles$6(styles$6)(Categories);
1852
- const React$7 = _dll_react;
1853
- const PropTypes$7 = _dll_prop_types;
1854
- const {withStyles: withStyles$7} = _dll_material_ui__core_styles;
1855
- const _jsxFileName$7 = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/categories/alternateResponses.jsx";
1856
- const styles$7 = theme => ({
1857
- categories: {
1858
- marginBottom: theme.spacing.unit
1859
- },
1860
- categoriesHolder: {
1861
- display: 'grid',
1862
- gridRowGap: `${theme.spacing.unit}px`,
1863
- gridColumnGap: `${theme.spacing.unit}px`
1864
- },
1865
- row: {
1866
- display: 'grid',
1867
- gridTemplateColumns: 'repeat(2, 1fr)',
1868
- gridColumnGap: `${theme.spacing.unit}px`,
1869
- alignItems: 'baseline',
1870
- width: '100%',
1871
- marginTop: theme.spacing.unit,
1872
- marginBottom: 2 * theme.spacing.unit
1873
- },
1874
- rowLabel: {
1875
- gridColumn: '1/3'
1876
- },
1877
- rowLabelHolder: {
1878
- width: '100%'
1879
- }
1880
- });
1881
- class AlternateResponses extends React$7.Component {
1882
- constructor(...args) {
1883
- super(...args);
1884
- AlternateResponses.prototype.__init.call(this);
1885
- AlternateResponses.prototype.__init2.call(this);
1886
- }
1887
- static __initStatic() {
1888
- this.propTypes = {
1889
- altIndex: PropTypes$7.number.isRequired,
1890
- imageSupport: PropTypes$7.shape({
1891
- add: PropTypes$7.func.isRequired,
1892
- delete: PropTypes$7.func.isRequired
1893
- }),
1894
- classes: PropTypes$7.object.isRequired,
1895
- className: PropTypes$7.string,
1896
- categories: PropTypes$7.array,
1897
- onModelChanged: PropTypes$7.func,
1898
- model: PropTypes$7.object.isRequired
1899
- };
1900
- }
1901
- __init() {
1902
- this.addChoiceToCategory = (choice, categoryId) => {
1903
- const {altIndex, model: {correctResponse}, onModelChanged} = this.props;
1904
- correctResponse.forEach(a => {
1905
- if (a.category === categoryId) {
1906
- a.alternateResponses = a.alternateResponses || [];
1907
- if (!a.alternateResponses[altIndex]) {
1908
- a.alternateResponses[altIndex] = [];
1909
- }
1910
- a.alternateResponses[altIndex].push(choice.id);
1911
- return a;
1912
- }
1913
- return a;
1914
- });
1915
- onModelChanged({
1916
- correctResponse
1917
- });
1918
- };
1919
- }
1920
- __init2() {
1921
- this.deleteChoiceFromCategory = (category, choice) => {
1922
- const {altIndex, model: {correctResponse}, onModelChanged} = this.props;
1923
- correctResponse.forEach(a => {
1924
- if (a.category === category.id) {
1925
- if (a.alternateResponses[altIndex]) {
1926
- a.alternateResponses[altIndex] = a.alternateResponses[altIndex].filter(altId => altId !== choice.id);
1927
- }
1928
- }
1929
- return a;
1930
- });
1931
- onModelChanged({
1932
- correctResponse
1933
- });
1934
- };
1935
- }
1936
- render() {
1937
- const {model, classes, className, categories, imageSupport} = this.props;
1938
- const {categoriesPerRow} = model;
1939
- const holderStyle = {
1940
- gridTemplateColumns: `repeat(${categoriesPerRow}, 1fr)`
1941
- };
1942
- return React$7.createElement('div', {
1943
- className: classnames(classes.categories, className),
1944
- __self: this,
1945
- __source: {
1946
- fileName: _jsxFileName$7,
1947
- lineNumber: 100
1948
- }
1949
- }, React$7.createElement('div', {
1950
- className: classes.categoriesHolder,
1951
- style: holderStyle,
1952
- __self: this,
1953
- __source: {
1954
- fileName: _jsxFileName$7,
1955
- lineNumber: 101
1956
- }
1957
- }, categories.map((category, index) => React$7.createElement(Category$1, {
1958
- key: index,
1959
- imageSupport: imageSupport,
1960
- category: category,
1961
- onAddChoice: this.addChoiceToCategory,
1962
- onDeleteChoice: (choice, choiceIndex) => this.deleteChoiceFromCategory(category, choice, choiceIndex),
1963
- __self: this,
1964
- __source: {
1965
- fileName: _jsxFileName$7,
1966
- lineNumber: 103
1967
- }
1968
- }))));
1969
- }
1970
- }
1971
- AlternateResponses.__initStatic();
1972
- var AlternateResponses$1 = withStyles$7(styles$7)(AlternateResponses);
1973
- const require$$0$2 = _dll_react;
1974
- var DragHandle = createCommonjsModule(function (module, exports) {
1975
- Object.defineProperty(exports, "__esModule", {
1976
- value: true
1977
- });
1978
- exports.default = void 0;
1979
- var _react = interopRequireDefault(require$$0$2);
1980
- var _createSvgIcon = interopRequireDefault(createSvgIcon_1);
1981
- var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("defs", null, _react.default.createElement("path", {
1982
- id: "a",
1983
- d: "M0 0h24v24H0V0z"
1984
- })), _react.default.createElement("path", {
1985
- d: "M20 9H4v2h16V9zM4 15h16v-2H4v2z"
1986
- })), 'DragHandle');
1987
- exports.default = _default;
1988
- });
1989
- var DragHandle$1 = unwrapExports(DragHandle);
1990
- const React$8 = _dll_react;
1991
- const PropTypes$8 = _dll_prop_types;
1992
- const {withStyles: withStyles$8} = _dll_material_ui__core_styles;
1993
- const {Card: Card$1} = _dll_material_ui__core;
1994
- const {CardActions: CardActions$1} = _dll_material_ui__core;
1995
- const {DragSource: DragSource} = _dll_react_dnd;
1996
- const {uid: uid$1} = _dll_pie_lib__drag;
1997
- const {Checkbox: Checkbox} = _dll_pie_lib__config_ui;
1998
- const _jsxFileName$8 = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/choices/choice.jsx";
1999
- const log$2 = browser$1('@pie-element:categorize:configure:choice');
2000
- const canDrag = props => {
2001
- const count = props.choice.categoryCount || 0;
2002
- if (count === 0) {
2003
- return true;
2004
- } else {
2005
- return props.correctResponseCount < count;
2006
- }
2007
- };
2008
- class Choice$1 extends React$8.Component {
2009
- constructor(...args) {
2010
- super(...args);
2011
- Choice$1.prototype.__init.call(this);
2012
- Choice$1.prototype.__init2.call(this);
2013
- }
2014
- static __initStatic() {
2015
- this.propTypes = {
2016
- classes: PropTypes$8.object.isRequired,
2017
- className: PropTypes$8.string,
2018
- choice: PropTypes$8.object.isRequired,
2019
- onChange: PropTypes$8.func.isRequired,
2020
- onDelete: PropTypes$8.func.isRequired,
2021
- connectDragSource: PropTypes$8.func.isRequired,
2022
- connectDragPreview: PropTypes$8.func.isRequired,
2023
- correctResponseCount: PropTypes$8.number.isRequired,
2024
- imageSupport: PropTypes$8.shape({
2025
- add: PropTypes$8.func.isRequired,
2026
- delete: PropTypes$8.func.isRequired
2027
- })
2028
- };
2029
- }
2030
- static __initStatic2() {
2031
- this.defaultProps = {};
2032
- }
2033
- __init() {
2034
- this.changeContent = content => {
2035
- const {onChange, choice} = this.props;
2036
- choice.content = content;
2037
- onChange(choice);
2038
- };
2039
- }
2040
- __init2() {
2041
- this.changeCategoryCount = () => {
2042
- const {onChange, choice} = this.props;
2043
- if (choice.categoryCount === 1) {
2044
- choice.categoryCount = 0;
2045
- } else {
2046
- choice.categoryCount = 1;
2047
- }
2048
- onChange(choice);
2049
- };
2050
- }
2051
- render() {
2052
- const {classes, className, choice, onDelete, connectDragSource, connectDragPreview, imageSupport} = this.props;
2053
- const draggable = canDrag(this.props);
2054
- return React$8.createElement(Card$1, {
2055
- className: classnames(classes.choice, className),
2056
- __self: this,
2057
- __source: {
2058
- fileName: _jsxFileName$8,
2059
- lineNumber: 74
2060
- }
2061
- }, React$8.createElement(CardActions$1, {
2062
- className: classes.actions,
2063
- __self: this,
2064
- __source: {
2065
- fileName: _jsxFileName$8,
2066
- lineNumber: 75
2067
- }
2068
- }, connectDragSource(React$8.createElement('span', {
2069
- className: classnames(classes.dragHandle, draggable === false && classes.dragDisabled),
2070
- __self: this,
2071
- __source: {
2072
- fileName: _jsxFileName$8,
2073
- lineNumber: 77
2074
- }
2075
- }, React$8.createElement(DragHandle$1, {
2076
- color: draggable ? 'primary' : 'disabled',
2077
- __self: this,
2078
- __source: {
2079
- fileName: _jsxFileName$8,
2080
- lineNumber: 83
2081
- }
2082
- })))), connectDragPreview(React$8.createElement('span', {
2083
- __self: this,
2084
- __source: {
2085
- fileName: _jsxFileName$8,
2086
- lineNumber: 88
2087
- }
2088
- }, React$8.createElement(InputHeader$1, {
2089
- imageSupport: imageSupport,
2090
- label: choice.content,
2091
- onChange: this.changeContent,
2092
- onDelete: onDelete,
2093
- __self: this,
2094
- __source: {
2095
- fileName: _jsxFileName$8,
2096
- lineNumber: 89
2097
- }
2098
- }))), React$8.createElement(CardActions$1, {
2099
- className: classes.actions,
2100
- __self: this,
2101
- __source: {
2102
- fileName: _jsxFileName$8,
2103
- lineNumber: 98
2104
- }
2105
- }, React$8.createElement(DeleteButton, {
2106
- label: 'delete',
2107
- onClick: onDelete,
2108
- __self: this,
2109
- __source: {
2110
- fileName: _jsxFileName$8,
2111
- lineNumber: 99
2112
- }
2113
- }), React$8.createElement(Checkbox, {
2114
- mini: true,
2115
- label: 'Remove after placing',
2116
- checked: choice.categoryCount === 1,
2117
- onChange: this.changeCategoryCount,
2118
- __self: this,
2119
- __source: {
2120
- fileName: _jsxFileName$8,
2121
- lineNumber: 100
2122
- }
2123
- })));
2124
- }
2125
- }
2126
- Choice$1.__initStatic();
2127
- Choice$1.__initStatic2();
2128
- const styles$8 = theme => ({
2129
- actions: {
2130
- padding: 0,
2131
- justifyContent: 'space-between'
2132
- },
2133
- choice: {
2134
- padding: theme.spacing.unit,
2135
- overflow: 'visible'
2136
- },
2137
- dragHandle: {
2138
- cursor: 'move'
2139
- },
2140
- dragDisabled: {
2141
- cursor: 'inherit'
2142
- }
2143
- });
2144
- const StyledChoice = withStyles$8(styles$8)(Choice$1);
2145
- const spec$1 = {
2146
- canDrag,
2147
- beginDrag: props => {
2148
- const out = {
2149
- id: props.choice.id
2150
- };
2151
- log$2('[beginDrag] out:', out);
2152
- return out;
2153
- },
2154
- endDrag: (props, monitor) => {
2155
- if (!monitor.didDrop()) {
2156
- const item = monitor.getItem();
2157
- if (item.categoryId) {
2158
- log$2('wasnt droppped - what to do?');
2159
- props.onRemoveChoice(item);
2160
- }
2161
- }
2162
- }
2163
- };
2164
- const DraggableChoice = DragSource(({uid}) => uid, spec$1, (connect, monitor) => ({
2165
- connectDragSource: connect.dragSource(),
2166
- connectDragPreview: connect.dragPreview(),
2167
- isDragging: monitor.isDragging()
2168
- }))(StyledChoice);
2169
- var Choice$2 = uid$1.withUid(DraggableChoice);
2170
- const React$9 = _dll_react;
2171
- const PropTypes$9 = _dll_prop_types;
2172
- const {withStyles: withStyles$9} = _dll_material_ui__core_styles;
2173
- const {TextField: TextField$1} = _dll_material_ui__core;
2174
- const {List: List} = _dll_material_ui__core;
2175
- const {ListItem: ListItem} = _dll_material_ui__core;
2176
- const {ListItemText: ListItemText} = _dll_material_ui__core;
2177
- const {MenuItem: MenuItem} = _dll_material_ui__core;
2178
- const {Menu: Menu} = _dll_material_ui__core;
2179
- const {InputCheckbox: InputCheckbox} = _dll_pie_lib__config_ui;
2180
- const _jsxFileName$9 = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/choices/config.jsx";
2181
- const positionOptions = [{
2182
- label: 'Above',
2183
- value: 'above',
2184
- secondaryText: 'Choices will be shown above categories'
2185
- }, {
2186
- label: 'Below',
2187
- value: 'below',
2188
- secondaryText: 'Choices will be shown below categories'
2189
- }, {
2190
- label: 'Left',
2191
- value: 'left',
2192
- secondaryText: 'Choices will be shown to the left of the categories'
2193
- }, {
2194
- label: 'Right',
2195
- value: 'right',
2196
- secondaryText: 'Choices will be shown to the right of the categories'
2197
- }];
2198
- class Config extends React$9.Component {
2199
- constructor(...args) {
2200
- super(...args);
2201
- Config.prototype.__init.call(this);
2202
- Config.prototype.__init2.call(this);
2203
- Config.prototype.__init3.call(this);
2204
- Config.prototype.__init4.call(this);
2205
- Config.prototype.__init5.call(this);
2206
- Config.prototype.__init6.call(this);
2207
- Config.prototype.__init7.call(this);
2208
- Config.prototype.__init8.call(this);
2209
- Config.prototype.__init9.call(this);
2210
- }
2211
- static __initStatic() {
2212
- this.propTypes = {
2213
- classes: PropTypes$9.object.isRequired,
2214
- className: PropTypes$9.string,
2215
- config: PropTypes$9.object,
2216
- categoryCountIsOne: PropTypes$9.bool,
2217
- allChoicesHaveCount: PropTypes$9.func,
2218
- onModelChanged: PropTypes$9.func
2219
- };
2220
- }
2221
- static __initStatic2() {
2222
- this.defaultProps = {};
2223
- }
2224
- __init() {
2225
- this.state = {
2226
- anchorEl: null
2227
- };
2228
- }
2229
- __init2() {
2230
- this.toggleRemoveAllTiles = () => {
2231
- const {config, onModelChanged} = this.props;
2232
- const allAtOne = this.props.allChoicesHaveCount(1);
2233
- const update = config.choices.map(c => {
2234
- c.categoryCount = allAtOne ? 0 : 1;
2235
- return c;
2236
- });
2237
- onModelChanged({
2238
- choices: update
2239
- });
2240
- };
2241
- }
2242
- __init3() {
2243
- this.changeColumns = ({target}) => {
2244
- const {onModelChanged} = this.props;
2245
- const numberValue = parseInt(target.value, 10);
2246
- if (numberValue && numberValue >= 1 && numberValue <= 4) {
2247
- onModelChanged({
2248
- choicesPerRow: numberValue
2249
- });
2250
- }
2251
- };
2252
- }
2253
- __init4() {
2254
- this.changeLabel = ({target}) => {
2255
- this.props.onModelChanged({
2256
- choicesLabel: target.value
2257
- });
2258
- };
2259
- }
2260
- __init5() {
2261
- this.toggleShuffle = () => {
2262
- this.props.onModelChanged({
2263
- lockChoiceOrder: !this.props.config.lockChoiceOrder
2264
- });
2265
- };
2266
- }
2267
- __init6() {
2268
- this.changePosition = position => {
2269
- this.props.onModelChanged({
2270
- choicesPosition: position.value
2271
- });
2272
- this.setState({
2273
- anchorEl: null
2274
- });
2275
- };
2276
- }
2277
- __init7() {
2278
- this.handleClickPosition = event => {
2279
- this.setState({
2280
- anchorEl: event.currentTarget
2281
- });
2282
- };
2283
- }
2284
- __init8() {
2285
- this.handleMenuItemClick = (event, index) => {
2286
- this.setState({
2287
- selectedIndex: index,
2288
- anchorEl: null
2289
- });
2290
- };
2291
- }
2292
- __init9() {
2293
- this.handleClose = () => {
2294
- this.setState({
2295
- anchorEl: null
2296
- });
2297
- };
2298
- }
2299
- render() {
2300
- const {anchorEl} = this.state;
2301
- const {classes, className, categoryCountIsOne, config} = this.props;
2302
- const positionOption = positionOptions.find(option => option.value === config.choicesPosition) || positionOption[1];
2303
- return React$9.createElement('div', {
2304
- className: classnames(classes.config, className),
2305
- __self: this,
2306
- __source: {
2307
- fileName: _jsxFileName$9,
2308
- lineNumber: 111
2309
- }
2310
- }, React$9.createElement('div', {
2311
- className: classes.row,
2312
- __self: this,
2313
- __source: {
2314
- fileName: _jsxFileName$9,
2315
- lineNumber: 112
2316
- }
2317
- }, React$9.createElement(TextField$1, {
2318
- label: 'Choices per row',
2319
- type: "number",
2320
- inputProps: {
2321
- min: 1,
2322
- max: 4
2323
- },
2324
- value: config.choicesPerRow,
2325
- onChange: this.changeColumns,
2326
- __self: this,
2327
- __source: {
2328
- fileName: _jsxFileName$9,
2329
- lineNumber: 113
2330
- }
2331
- }), React$9.createElement(InputCheckbox, {
2332
- label: 'Remove all tiles after placing',
2333
- checked: categoryCountIsOne,
2334
- onChange: this.toggleRemoveAllTiles,
2335
- __self: this,
2336
- __source: {
2337
- fileName: _jsxFileName$9,
2338
- lineNumber: 123
2339
- }
2340
- }), React$9.createElement(InputCheckbox, {
2341
- className: classes.shuffleCheckbox,
2342
- label: 'Lock Choice Order',
2343
- checked: config.lockChoiceOrder,
2344
- onChange: this.toggleShuffle,
2345
- __self: this,
2346
- __source: {
2347
- fileName: _jsxFileName$9,
2348
- lineNumber: 128
2349
- }
2350
- })), React$9.createElement('div', {
2351
- className: classes.configuration,
2352
- __self: this,
2353
- __source: {
2354
- fileName: _jsxFileName$9,
2355
- lineNumber: 136
2356
- }
2357
- }, React$9.createElement(TextField$1, {
2358
- className: classes.label,
2359
- InputLabelProps: {
2360
- shrink: true
2361
- },
2362
- label: "Label",
2363
- value: config.choicesLabel,
2364
- onChange: this.changeLabel,
2365
- __self: this,
2366
- __source: {
2367
- fileName: _jsxFileName$9,
2368
- lineNumber: 137
2369
- }
2370
- }), React$9.createElement(List, {
2371
- component: "nav",
2372
- __self: this,
2373
- __source: {
2374
- fileName: _jsxFileName$9,
2375
- lineNumber: 146
2376
- }
2377
- }, React$9.createElement(ListItem, {
2378
- button: true,
2379
- 'aria-haspopup': "true",
2380
- onClick: this.handleClickPosition,
2381
- __self: this,
2382
- __source: {
2383
- fileName: _jsxFileName$9,
2384
- lineNumber: 147
2385
- }
2386
- }, React$9.createElement(ListItemText, {
2387
- primary: "Choices Position",
2388
- secondary: positionOption.secondaryText,
2389
- __self: this,
2390
- __source: {
2391
- fileName: _jsxFileName$9,
2392
- lineNumber: 152
2393
- }
2394
- }))), React$9.createElement(Menu, {
2395
- id: "lock-menu",
2396
- anchorEl: anchorEl,
2397
- open: Boolean(anchorEl),
2398
- onClose: this.handleClose,
2399
- __self: this,
2400
- __source: {
2401
- fileName: _jsxFileName$9,
2402
- lineNumber: 158
2403
- }
2404
- }, positionOptions.map(option => React$9.createElement(MenuItem, {
2405
- key: option.value,
2406
- selected: option.value === config.choicesPosition,
2407
- onClick: () => this.changePosition(option),
2408
- __self: this,
2409
- __source: {
2410
- fileName: _jsxFileName$9,
2411
- lineNumber: 165
2412
- }
2413
- }, option.label)))));
2414
- }
2415
- }
2416
- Config.__initStatic();
2417
- Config.__initStatic2();
2418
- const styles$9 = theme => ({
2419
- configuration: {
2420
- display: 'grid',
2421
- alignItems: 'center',
2422
- gridColumnGap: `${theme.spacing.unit}px`,
2423
- gridRowGap: `${theme.spacing.unit}px`,
2424
- gridTemplateColumns: 'repeat(2, 1fr)',
2425
- justifyContent: 'space-between',
2426
- marginBottom: theme.spacing.unit
2427
- },
2428
- choiceConfig: {
2429
- width: '100%',
2430
- maxWidth: 360,
2431
- backgroundColor: theme.palette.background.paper
2432
- },
2433
- row: {
2434
- display: 'grid',
2435
- gridColumnGap: `${theme.spacing.unit}px`,
2436
- gridRowGap: `${theme.spacing.unit}px`,
2437
- gridTemplateColumns: 'repeat(2, 1fr)',
2438
- justifyContent: 'space-between',
2439
- marginTop: theme.spacing.unit,
2440
- marginBottom: theme.spacing.unit
2441
- },
2442
- shuffleCheckbox: {
2443
- gridColumnStart: 2,
2444
- gridColumnEnd: 2
2445
- }
2446
- });
2447
- var Config$1 = withStyles$9(styles$9)(Config);
2448
- const React$a = _dll_react;
2449
- const PropTypes$a = _dll_prop_types;
2450
- const {withStyles: withStyles$a} = _dll_material_ui__core_styles;
2451
- const {every: every} = _dll_lodash;
2452
- const {choiceUtils: utils$1} = _dll_pie_lib__config_ui;
2453
- const _jsxFileName$a = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/choices/index.jsx";
2454
- class Choices extends React$a.Component {
2455
- constructor(...args) {
2456
- super(...args);
2457
- Choices.prototype.__init.call(this);
2458
- Choices.prototype.__init2.call(this);
2459
- Choices.prototype.__init3.call(this);
2460
- Choices.prototype.__init4.call(this);
2461
- }
2462
- static __initStatic() {
2463
- this.propTypes = {
2464
- model: PropTypes$a.object.isRequired,
2465
- classes: PropTypes$a.object.isRequired,
2466
- className: PropTypes$a.string,
2467
- choices: PropTypes$a.array.isRequired,
2468
- onModelChanged: PropTypes$a.func.isRequired,
2469
- imageSupport: PropTypes$a.shape({
2470
- add: PropTypes$a.func.isRequired,
2471
- delete: PropTypes$a.func.isRequired
2472
- })
2473
- };
2474
- }
2475
- static __initStatic2() {
2476
- this.defaultProps = {};
2477
- }
2478
- __init() {
2479
- this.changeChoice = choice => {
2480
- const {choices, onModelChanged} = this.props;
2481
- const index = choices.findIndex(h => h.id === choice.id);
2482
- if (index !== -1) {
2483
- choices.splice(index, 1, choice);
2484
- onModelChanged({
2485
- choices
2486
- });
2487
- }
2488
- };
2489
- }
2490
- __init2() {
2491
- this.allChoicesHaveCount = count => {
2492
- const {choices} = this.props;
2493
- return every(choices, c => c.categoryCount === count);
2494
- };
2495
- }
2496
- __init3() {
2497
- this.addChoice = () => {
2498
- const {onModelChanged, model} = this.props;
2499
- const id = utils$1.firstAvailableIndex(model.choices.map(a => a.id), 0);
2500
- const data = {
2501
- id,
2502
- content: 'Choice ' + id
2503
- };
2504
- onModelChanged({
2505
- choices: model.choices.concat([data])
2506
- });
2507
- };
2508
- }
2509
- __init4() {
2510
- this.deleteChoice = choice => {
2511
- const {model, onModelChanged} = this.props;
2512
- const index = model.choices.findIndex(a => a.id === choice.id);
2513
- if (index !== -1) {
2514
- model.choices.splice(index, 1);
2515
- model.correctResponse = removeAllChoices(choice.id, model.correctResponse);
2516
- onModelChanged(model);
2517
- }
2518
- };
2519
- }
2520
- render() {
2521
- const {classes, className, choices, model, imageSupport, onModelChanged} = this.props;
2522
- const categoryCountIsOne = this.allChoicesHaveCount(1);
2523
- const choiceHolderStyle = {
2524
- gridTemplateColumns: `repeat(${model.choicesPerRow}, 1fr)`
2525
- };
2526
- return React$a.createElement('div', {
2527
- className: classnames(classes.choices, className),
2528
- __self: this,
2529
- __source: {
2530
- fileName: _jsxFileName$a,
2531
- lineNumber: 80
2532
- }
2533
- }, React$a.createElement(Header$1, {
2534
- label: "Choices",
2535
- buttonLabel: "ADD A CHOICE",
2536
- onAdd: this.addChoice,
2537
- __self: this,
2538
- __source: {
2539
- fileName: _jsxFileName$a,
2540
- lineNumber: 81
2541
- }
2542
- }), React$a.createElement(Config$1, {
2543
- config: model,
2544
- categoryCountIsOne: categoryCountIsOne,
2545
- onModelChanged: onModelChanged,
2546
- allChoicesHaveCount: this.allChoicesHaveCount,
2547
- __self: this,
2548
- __source: {
2549
- fileName: _jsxFileName$a,
2550
- lineNumber: 82
2551
- }
2552
- }), React$a.createElement('div', {
2553
- className: classes.choiceHolder,
2554
- style: choiceHolderStyle,
2555
- __self: this,
2556
- __source: {
2557
- fileName: _jsxFileName$a,
2558
- lineNumber: 88
2559
- }
2560
- }, choices.map((h, index) => React$a.createElement(Choice$2, {
2561
- choice: h,
2562
- correctResponseCount: h.correctResponseCount,
2563
- key: index,
2564
- imageSupport: imageSupport,
2565
- onChange: this.changeChoice,
2566
- onDelete: () => this.deleteChoice(h),
2567
- __self: this,
2568
- __source: {
2569
- fileName: _jsxFileName$a,
2570
- lineNumber: 90
2571
- }
2572
- }))), React$a.createElement(Divider, {
2573
- __self: this,
2574
- __source: {
2575
- fileName: _jsxFileName$a,
2576
- lineNumber: 100
2577
- }
2578
- }));
2579
- }
2580
- }
2581
- Choices.__initStatic();
2582
- Choices.__initStatic2();
2583
- const styles$a = theme => ({
2584
- choiceHolder: {
2585
- paddingTop: theme.spacing.unit,
2586
- paddingBottom: theme.spacing.unit,
2587
- display: 'grid',
2588
- gridRowGap: `${theme.spacing.unit}px`,
2589
- gridColumnGap: `${theme.spacing.unit}px`
2590
- },
2591
- choices: {
2592
- paddingTop: theme.spacing.unit * 2,
2593
- paddingBottom: theme.spacing.unit * 2
2594
- },
2595
- label: {}
2596
- });
2597
- var Choices$1 = withStyles$a(styles$a)(Choices);
2598
- const {cloneDeep: cloneDeep} = _dll_lodash;
2599
- const buildCategories = (categories, choices, correctResponse) => {
2600
- const clonedCategories = cloneDeep(categories);
2601
- return clonedCategories.map(category => {
2602
- const cr = correctResponse.find(cr => cr.category === category.id);
2603
- if (cr) {
2604
- category.choices = (cr.choices || []).map(choiceId => {
2605
- const choice = choices.find(h => h.id === choiceId);
2606
- return Object.assign({}, {
2607
- id: choice.id,
2608
- content: choice.content
2609
- });
2610
- });
2611
- }
2612
- return category;
2613
- });
2614
- };
2615
- const getChoices = (cat, choices, index) => {
2616
- if (!cat.alternateResponses || cat.alternateResponses.length === 0) {
2617
- return [];
2618
- }
2619
- return (cat.alternateResponses[index] || []).map(alt => {
2620
- return choices.find(ch => ch.id === alt);
2621
- });
2622
- };
2623
- const buildAlternateResponses = (categories, choices, correctResponse) => {
2624
- const mostAlternates = correctResponse.reduce((mostAlt, cat) => {
2625
- if (cat.alternateResponses && cat.alternateResponses.length >= mostAlt) {
2626
- return cat.alternateResponses.length;
2627
- }
2628
- return mostAlt;
2629
- }, 0);
2630
- const alternatesArray = new Array(mostAlternates).fill(0);
2631
- return alternatesArray.map((val, index) => {
2632
- return correctResponse.map((cat, catIndex) => {
2633
- const currentCategory = categories[catIndex];
2634
- return {
2635
- id: currentCategory.id,
2636
- label: currentCategory.label,
2637
- choices: getChoices(cat, choices, index)
2638
- };
2639
- });
2640
- });
2641
- };
2642
- const React$b = _dll_react;
2643
- const PropTypes$b = _dll_prop_types;
2644
- const {withStyles: withStyles$b} = _dll_material_ui__core_styles;
2645
- const {uid: uid$2} = _dll_pie_lib__drag;
2646
- const {withDragContext: withDragContext} = _dll_pie_lib__drag;
2647
- const {FeedbackConfig: FeedbackConfig} = _dll_pie_lib__config_ui;
2648
- const {InputContainer: InputContainer} = _dll_pie_lib__config_ui;
2649
- const {layout: layout} = _dll_pie_lib__config_ui;
2650
- const {settings: settings} = _dll_pie_lib__config_ui;
2651
- const EditableHtml$2 = _dll_pie_lib__editable_html;
2652
- const _jsxFileName$b = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/design/index.jsx";
2653
- const {Panel, toggle, radio} = settings;
2654
- const {Provider: IdProvider} = uid$2;
2655
- class Design extends React$b.Component {
2656
- static __initStatic() {
2657
- this.propTypes = {
2658
- classes: PropTypes$b.object.isRequired,
2659
- configuration: PropTypes$b.object,
2660
- className: PropTypes$b.string,
2661
- onConfigurationChanged: PropTypes$b.func,
2662
- model: PropTypes$b.object.isRequired,
2663
- onChange: PropTypes$b.func.isRequired,
2664
- uid: PropTypes$b.string,
2665
- imageSupport: PropTypes$b.shape({
2666
- add: PropTypes$b.func.isRequired,
2667
- delete: PropTypes$b.func.isRequired
2668
- })
2669
- };
2670
- }
2671
- constructor(props) {
2672
- super(props);
2673
- Design.prototype.__init.call(this);
2674
- Design.prototype.__init2.call(this);
2675
- Design.prototype.__init3.call(this);
2676
- Design.prototype.__init4.call(this);
2677
- Design.prototype.__init5.call(this);
2678
- Design.prototype.__init6.call(this);
2679
- Design.prototype.__init7.call(this);
2680
- Design.prototype.__init8.call(this);
2681
- this.uid = props.uid || uid$2.generateId();
2682
- }
2683
- __init() {
2684
- this.updateModel = props => {
2685
- const {model, onChange} = this.props;
2686
- const updatedModel = {
2687
- ...model,
2688
- ...props
2689
- };
2690
- updatedModel.correctResponse = ensureNoExtraChoicesInAnswer(updatedModel.correctResponse || [], updatedModel.choices);
2691
- updatedModel.categories = updatedModel.categories.map(c => ({
2692
- id: c.id,
2693
- label: c.label
2694
- }));
2695
- updatedModel.choices = updatedModel.choices.map(h => ({
2696
- id: h.id,
2697
- content: h.content,
2698
- categoryCount: h.categoryCount
2699
- }));
2700
- onChange(updatedModel);
2701
- };
2702
- }
2703
- __init2() {
2704
- this.changeRationale = rationale => {
2705
- const {model, onChange} = this.props;
2706
- onChange({
2707
- ...model,
2708
- rationale
2709
- });
2710
- };
2711
- }
2712
- __init3() {
2713
- this.changeTeacherInstructions = teacherInstructions => {
2714
- const {model, onChange} = this.props;
2715
- onChange({
2716
- ...model,
2717
- teacherInstructions
2718
- });
2719
- };
2720
- }
2721
- __init4() {
2722
- this.changeFeedback = feedback => {
2723
- this.updateModel({
2724
- feedback
2725
- });
2726
- };
2727
- }
2728
- __init5() {
2729
- this.onAddAlternateResponse = () => {
2730
- const {model: {correctResponse}} = this.props;
2731
- this.updateModel({
2732
- correctResponse: (correctResponse || []).map(cr => ({
2733
- ...cr,
2734
- alternateResponses: [...cr.alternateResponses || [], []]
2735
- }))
2736
- });
2737
- };
2738
- }
2739
- __init6() {
2740
- this.onPromptChanged = prompt => this.updateModel({
2741
- prompt
2742
- });
2743
- }
2744
- __init7() {
2745
- this.onRemoveAlternateResponse = index => {
2746
- const {model: {correctResponse}} = this.props;
2747
- this.updateModel({
2748
- correctResponse: (correctResponse || []).map(cr => ({
2749
- ...cr,
2750
- alternateResponses: (cr.alternateResponses || []).filter((alt, altIndex) => altIndex !== index)
2751
- }))
2752
- });
2753
- };
2754
- }
2755
- __init8() {
2756
- this.countChoiceInCorrectResponse = choice => {
2757
- const {model} = this.props;
2758
- return countInAnswer(choice.id, model.correctResponse);
2759
- };
2760
- }
2761
- render() {
2762
- const {classes, className, model, imageSupport, configuration, onChange, onConfigurationChanged} = this.props;
2763
- const {partialScoring = {}, lockChoiceOrder = {}, teacherInstructions = {}, studentInstructions = {}, rationale = {}, scoringType = {}, feedback = {}, prompt = {}} = configuration || ({});
2764
- const {teacherInstructionsEnabled, promptEnabled, rationaleEnabled, feedbackEnabled} = model || ({});
2765
- const config = model.config || ({});
2766
- config.choices = config.choices || ({
2767
- label: '',
2768
- columns: 2
2769
- });
2770
- const categories = buildCategories(model.categories || [], model.choices || [], model.correctResponse || []);
2771
- const alternateResponses = buildAlternateResponses(model.categories || [], model.choices || [], model.correctResponse || []);
2772
- const choices = model.choices.map(c => {
2773
- c.correctResponseCount = this.countChoiceInCorrectResponse(c);
2774
- return c;
2775
- });
2776
- return React$b.createElement(IdProvider, {
2777
- value: this.uid,
2778
- __self: this,
2779
- __source: {
2780
- fileName: _jsxFileName$b,
2781
- lineNumber: 183
2782
- }
2783
- }, React$b.createElement(layout.ConfigLayout, {
2784
- settings: React$b.createElement(Panel, {
2785
- model: model,
2786
- onChangeModel: onChange,
2787
- configuration: configuration,
2788
- onChangeConfiguration: onConfigurationChanged,
2789
- groups: {
2790
- Settings: {
2791
- partialScoring: partialScoring.settings && toggle(partialScoring.label),
2792
- lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
2793
- promptEnabled: prompt.settings && toggle(prompt.label),
2794
- feedbackEnabled: feedback.settings && toggle(feedback.label)
2795
- },
2796
- Properties: {
2797
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
2798
- studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
2799
- rationaleEnabled: rationale.settings && toggle(rationale.label),
2800
- scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
2801
- }
2802
- },
2803
- __self: this,
2804
- __source: {
2805
- fileName: _jsxFileName$b,
2806
- lineNumber: 186
2807
- }
2808
- }),
2809
- __self: this,
2810
- __source: {
2811
- fileName: _jsxFileName$b,
2812
- lineNumber: 184
2813
- }
2814
- }, React$b.createElement('div', {
2815
- className: classnames(classes.design, className),
2816
- __self: this,
2817
- __source: {
2818
- fileName: _jsxFileName$b,
2819
- lineNumber: 218
2820
- }
2821
- }, promptEnabled && React$b.createElement(InputContainer, {
2822
- label: prompt.label,
2823
- className: classes.promptHolder,
2824
- __self: this,
2825
- __source: {
2826
- fileName: _jsxFileName$b,
2827
- lineNumber: 220
2828
- }
2829
- }, React$b.createElement(EditableHtml$2, {
2830
- className: classes.prompt,
2831
- markup: model.prompt || '',
2832
- onChange: this.onPromptChanged,
2833
- imageSupport: imageSupport,
2834
- nonEmpty: false,
2835
- disableUnderline: true,
2836
- __self: this,
2837
- __source: {
2838
- fileName: _jsxFileName$b,
2839
- lineNumber: 224
2840
- }
2841
- })), teacherInstructionsEnabled && React$b.createElement(InputContainer, {
2842
- label: teacherInstructions.label,
2843
- className: classes.inputHolder,
2844
- __self: this,
2845
- __source: {
2846
- fileName: _jsxFileName$b,
2847
- lineNumber: 236
2848
- }
2849
- }, React$b.createElement(EditableHtml$2, {
2850
- className: classes.input,
2851
- markup: model.teacherInstructions || '',
2852
- onChange: this.changeTeacherInstructions,
2853
- imageSupport: imageSupport,
2854
- nonEmpty: false,
2855
- __self: this,
2856
- __source: {
2857
- fileName: _jsxFileName$b,
2858
- lineNumber: 240
2859
- }
2860
- })), rationaleEnabled && React$b.createElement(InputContainer, {
2861
- label: rationale.label,
2862
- className: classes.inputHolder,
2863
- __self: this,
2864
- __source: {
2865
- fileName: _jsxFileName$b,
2866
- lineNumber: 251
2867
- }
2868
- }, React$b.createElement(EditableHtml$2, {
2869
- className: classes.input,
2870
- markup: model.rationale || '',
2871
- onChange: this.changeRationale,
2872
- imageSupport: imageSupport,
2873
- nonEmpty: false,
2874
- __self: this,
2875
- __source: {
2876
- fileName: _jsxFileName$b,
2877
- lineNumber: 255
2878
- }
2879
- })), React$b.createElement(Categories$1, {
2880
- imageSupport: imageSupport,
2881
- model: model,
2882
- categories: categories || [],
2883
- onModelChanged: this.updateModel,
2884
- __self: this,
2885
- __source: {
2886
- fileName: _jsxFileName$b,
2887
- lineNumber: 265
2888
- }
2889
- }), React$b.createElement(Header$1, {
2890
- className: classes.alternatesHeader,
2891
- label: "Alternate Responses",
2892
- buttonLabel: "ADD AN ALTERNATE RESPONSE",
2893
- onAdd: this.onAddAlternateResponse,
2894
- __self: this,
2895
- __source: {
2896
- fileName: _jsxFileName$b,
2897
- lineNumber: 272
2898
- }
2899
- }), alternateResponses.map((categoriesList, index) => {
2900
- return React$b.createElement(React$b.Fragment, {
2901
- key: index,
2902
- __self: this,
2903
- __source: {
2904
- fileName: _jsxFileName$b,
2905
- lineNumber: 281
2906
- }
2907
- }, React$b.createElement(Header$1, {
2908
- className: classes.alternatesHeader,
2909
- label: "Alternate Response",
2910
- buttonLabel: "REMOVE ALTERNATE RESPONSE",
2911
- onAdd: () => this.onRemoveAlternateResponse(index),
2912
- __self: this,
2913
- __source: {
2914
- fileName: _jsxFileName$b,
2915
- lineNumber: 282
2916
- }
2917
- }), React$b.createElement(AlternateResponses$1, {
2918
- altIndex: index,
2919
- imageSupport: imageSupport,
2920
- model: model,
2921
- categories: categoriesList,
2922
- onModelChanged: this.updateModel,
2923
- __self: this,
2924
- __source: {
2925
- fileName: _jsxFileName$b,
2926
- lineNumber: 289
2927
- }
2928
- }));
2929
- }), React$b.createElement(Divider, {
2930
- __self: this,
2931
- __source: {
2932
- fileName: _jsxFileName$b,
2933
- lineNumber: 300
2934
- }
2935
- }), React$b.createElement(Choices$1, {
2936
- imageSupport: imageSupport,
2937
- choices: choices,
2938
- model: model,
2939
- onModelChanged: this.updateModel,
2940
- __self: this,
2941
- __source: {
2942
- fileName: _jsxFileName$b,
2943
- lineNumber: 301
2944
- }
2945
- }), feedbackEnabled && React$b.createElement(FeedbackConfig, {
2946
- feedback: model.feedback,
2947
- onChange: this.changeFeedback,
2948
- __self: this,
2949
- __source: {
2950
- fileName: _jsxFileName$b,
2951
- lineNumber: 309
2952
- }
2953
- }))));
2954
- }
2955
- }
2956
- Design.__initStatic();
2957
- const styles$b = theme => ({
2958
- alternatesHeader: {
2959
- paddingTop: theme.spacing.unit * 2,
2960
- paddingBottom: theme.spacing.unit * 2
2961
- },
2962
- text: {
2963
- paddingTop: theme.spacing.unit * 2,
2964
- paddingBottom: theme.spacing.unit * 2
2965
- },
2966
- design: {
2967
- paddingTop: theme.spacing.unit,
2968
- paddingBottom: theme.spacing.unit
2969
- },
2970
- inputHolder: {
2971
- width: '100%',
2972
- paddingBottom: theme.spacing.unit * 2,
2973
- marginBottom: theme.spacing.unit * 2
2974
- },
2975
- input: {
2976
- paddingTop: theme.spacing.unit * 2,
2977
- width: '100%',
2978
- maxWidth: '600px'
2979
- },
2980
- prompt: {
2981
- paddingTop: theme.spacing.unit * 2,
2982
- width: '100%'
2983
- },
2984
- promptHolder: {
2985
- width: '100%',
2986
- paddingBottom: theme.spacing.unit * 2,
2987
- marginBottom: theme.spacing.unit * 2
2988
- },
2989
- title: {
2990
- marginBottom: '30px'
2991
- }
2992
- });
2993
- var Design$1 = withDragContext(withStyles$b(styles$b)(Design));
2994
- const React$c = _dll_react;
2995
- const PropTypes$c = _dll_prop_types;
2996
- const {withStyles: withStyles$c} = _dll_material_ui__core_styles;
2997
- const _jsxFileName$c = "/home/ede/dev/github/pie-framework/pie-elements/packages/categorize/configure/src/main.jsx";
2998
- class Main extends React$c.Component {
2999
- static __initStatic() {
3000
- this.propTypes = {
3001
- classes: PropTypes$c.object.isRequired,
3002
- configuration: PropTypes$c.object,
3003
- className: PropTypes$c.string,
3004
- onConfigurationChanged: PropTypes$c.func,
3005
- model: PropTypes$c.object.isRequired,
3006
- onModelChanged: PropTypes$c.func.isRequired,
3007
- imageSupport: PropTypes$c.object
3008
- };
3009
- }
3010
- static __initStatic2() {
3011
- this.defaultProps = {};
3012
- }
3013
- render() {
3014
- const {classes, className, model, onModelChanged, configuration, onConfigurationChanged} = this.props;
3015
- return React$c.createElement('div', {
3016
- className: classnames(classes.main, className),
3017
- __self: this,
3018
- __source: {
3019
- fileName: _jsxFileName$c,
3020
- lineNumber: 31
3021
- }
3022
- }, React$c.createElement(Design$1, {
3023
- imageSupport: this.props.imageSupport,
3024
- title: "Design",
3025
- model: model,
3026
- configuration: configuration,
3027
- onChange: onModelChanged,
3028
- onConfigurationChanged: onConfigurationChanged,
3029
- __self: this,
3030
- __source: {
3031
- fileName: _jsxFileName$c,
3032
- lineNumber: 32
3033
- }
3034
- }));
3035
- }
3036
- }
3037
- Main.__initStatic();
3038
- Main.__initStatic2();
3039
- const styles$c = () => ({
3040
- main: {}
3041
- });
3042
- var Main$1 = withStyles$c(styles$c)(Main);
3043
- var defaults = {
3044
- model: {
3045
- choices: [],
3046
- choicesPerRow: 2,
3047
- choicesPosition: 'below',
3048
- choicesLabel: '',
3049
- lockChoiceOrder: true,
3050
- removeTilesAfterPlacing: false,
3051
- categoriesPerRow: 2,
3052
- categories: [],
3053
- alternates: [],
3054
- correctResponse: [],
3055
- rowLabels: [''],
3056
- partialScoring: true,
3057
- feedbackEnabled: true,
3058
- rationaleEnabled: true,
3059
- promptEnabled: true,
3060
- teacherInstructionsEnabled: true,
3061
- studentInstructionsEnabled: true
3062
- },
3063
- configuration: {
3064
- feedback: {
3065
- settings: true,
3066
- label: 'Feedback',
3067
- enabled: true
3068
- },
3069
- lockChoiceOrder: {
3070
- settings: false,
3071
- label: 'Lock Choice Order'
3072
- },
3073
- partialScoring: {
3074
- settings: false,
3075
- label: 'Allow Partial Scoring'
3076
- },
3077
- prompt: {
3078
- settings: true,
3079
- label: 'Prompt'
3080
- },
3081
- rationale: {
3082
- settings: true,
3083
- label: 'Rationale'
3084
- },
3085
- scoringType: {
3086
- settings: false,
3087
- label: 'Scoring Type'
3088
- },
3089
- studentInstructions: {
3090
- settings: false,
3091
- label: 'Student Instructions'
3092
- },
3093
- teacherInstructions: {
3094
- settings: true,
3095
- label: 'Teacher Instructions'
3096
- }
3097
- }
3098
- };
3099
- const React$d = _dll_react;
3100
- const ReactDOM = _dll_react_dom;
3101
- const {ModelUpdatedEvent: ModelUpdatedEvent} = _dll_pie_framework__pie_configure_events;
3102
- const {DeleteImageEvent: DeleteImageEvent} = _dll_pie_framework__pie_configure_events;
3103
- const {InsertImageEvent: InsertImageEvent} = _dll_pie_framework__pie_configure_events;
3104
- class CategorizeConfigure extends HTMLElement {
3105
- static __initStatic() {
3106
- this.createDefaultModel = (model = {}) => ({
3107
- ...defaults.model,
3108
- ...model
3109
- });
3110
- }
3111
- constructor() {
3112
- super();
3113
- this._model = CategorizeConfigure.createDefaultModel();
3114
- this._configuration = defaults.configuration;
3115
- }
3116
- set model(m) {
3117
- this._model = CategorizeConfigure.createDefaultModel(m);
3118
- this.render();
3119
- }
3120
- set configuration(c) {
3121
- this._configuration = c;
3122
- this.render();
3123
- }
3124
- onModelChanged(m) {
3125
- this._model = m;
3126
- this.render();
3127
- this.dispatchEvent(new ModelUpdatedEvent(this._model, true));
3128
- }
3129
- onConfigurationChanged(c) {
3130
- this._configuration = c;
3131
- this.render();
3132
- }
3133
- connectedCallback() {}
3134
- insertImage(handler) {
3135
- this.dispatchEvent(new InsertImageEvent(handler));
3136
- }
3137
- onDeleteImage(src, done) {
3138
- this.dispatchEvent(new DeleteImageEvent(src, done));
3139
- }
3140
- render() {
3141
- const el = React$d.createElement(Main$1, {
3142
- model: this._model,
3143
- configuration: this._configuration,
3144
- onModelChanged: this.onModelChanged.bind(this),
3145
- onConfigurationChanged: this.onConfigurationChanged.bind(this),
3146
- imageSupport: {
3147
- add: this.insertImage.bind(this),
3148
- delete: this.onDeleteImage.bind(this)
3149
- }
3150
- });
3151
- ReactDOM.render(el, this);
3152
- }
3153
- }
3154
- CategorizeConfigure.__initStatic();
3155
- export default CategorizeConfigure;