@pie-element/graphing 3.5.3 → 3.5.4-next.1016

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 (41) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/configure/CHANGELOG.md +152 -0
  3. package/configure/lib/configure.js +108 -47
  4. package/configure/lib/configure.js.map +1 -1
  5. package/configure/lib/correct-response.js +287 -54
  6. package/configure/lib/correct-response.js.map +1 -1
  7. package/configure/lib/defaults.js +49 -7
  8. package/configure/lib/defaults.js.map +1 -1
  9. package/configure/lib/graphing-config.js +160 -184
  10. package/configure/lib/graphing-config.js.map +1 -1
  11. package/configure/lib/index.js +43 -18
  12. package/configure/lib/index.js.map +1 -1
  13. package/configure/lib/utils.js +94 -0
  14. package/configure/lib/utils.js.map +1 -0
  15. package/configure/package.json +4 -4
  16. package/controller/CHANGELOG.md +40 -0
  17. package/controller/lib/defaults.js +9 -1
  18. package/controller/lib/defaults.js.map +1 -1
  19. package/controller/lib/index.js +48 -23
  20. package/controller/lib/index.js.map +1 -1
  21. package/controller/lib/utils.js +8 -6
  22. package/controller/lib/utils.js.map +1 -1
  23. package/controller/package.json +1 -1
  24. package/docs/config-schema.json +282 -0
  25. package/docs/config-schema.json.md +213 -1
  26. package/docs/demo/generate.js +8 -1
  27. package/docs/pie-schema.json +228 -3
  28. package/docs/pie-schema.json.md +166 -2
  29. package/lib/index.js +4 -1
  30. package/lib/index.js.map +1 -1
  31. package/lib/main.js +15 -19
  32. package/lib/main.js.map +1 -1
  33. package/lib/utils.js +3 -1
  34. package/lib/utils.js.map +1 -1
  35. package/package.json +6 -6
  36. package/module/configure.js +0 -1260
  37. package/module/controller.js +0 -21893
  38. package/module/demo.js +0 -92
  39. package/module/element.js +0 -245
  40. package/module/index.html +0 -16
  41. package/module/manifest.json +0 -14
@@ -1,1260 +0,0 @@
1
- import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_lodash, _dll_react_dom} from "../../../@pie-ui/shared-lib@^4.3.3/module/index.js";
2
- import {_dll_pie_lib__config_ui, _dll_pie_lib__editable_html, _dll_pie_framework__pie_configure_events} from "../../shared-config@^1.8.13/module/index.js";
3
- import {_dll_pie_lib__graphing} from "../../../@pie-ui/shared-graphing@^4.5.18/module/index.js";
4
- function createCommonjsModule(fn, module) {
5
- return (module = {
6
- exports: {}
7
- }, fn(module, module.exports), module.exports);
8
- }
9
- var s = 1000;
10
- var m = s * 60;
11
- var h = m * 60;
12
- var d = h * 24;
13
- var w = d * 7;
14
- var y = d * 365.25;
15
- var ms = function (val, options) {
16
- options = options || ({});
17
- var type = typeof val;
18
- if (type === 'string' && val.length > 0) {
19
- return parse(val);
20
- } else if (type === 'number' && isFinite(val)) {
21
- return options.long ? fmtLong(val) : fmtShort(val);
22
- }
23
- throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
24
- };
25
- function parse(str) {
26
- str = String(str);
27
- if (str.length > 100) {
28
- return;
29
- }
30
- 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);
31
- if (!match) {
32
- return;
33
- }
34
- var n = parseFloat(match[1]);
35
- var type = (match[2] || 'ms').toLowerCase();
36
- switch (type) {
37
- case 'years':
38
- case 'year':
39
- case 'yrs':
40
- case 'yr':
41
- case 'y':
42
- return n * y;
43
- case 'weeks':
44
- case 'week':
45
- case 'w':
46
- return n * w;
47
- case 'days':
48
- case 'day':
49
- case 'd':
50
- return n * d;
51
- case 'hours':
52
- case 'hour':
53
- case 'hrs':
54
- case 'hr':
55
- case 'h':
56
- return n * h;
57
- case 'minutes':
58
- case 'minute':
59
- case 'mins':
60
- case 'min':
61
- case 'm':
62
- return n * m;
63
- case 'seconds':
64
- case 'second':
65
- case 'secs':
66
- case 'sec':
67
- case 's':
68
- return n * s;
69
- case 'milliseconds':
70
- case 'millisecond':
71
- case 'msecs':
72
- case 'msec':
73
- case 'ms':
74
- return n;
75
- default:
76
- return undefined;
77
- }
78
- }
79
- function fmtShort(ms) {
80
- var msAbs = Math.abs(ms);
81
- if (msAbs >= d) {
82
- return Math.round(ms / d) + 'd';
83
- }
84
- if (msAbs >= h) {
85
- return Math.round(ms / h) + 'h';
86
- }
87
- if (msAbs >= m) {
88
- return Math.round(ms / m) + 'm';
89
- }
90
- if (msAbs >= s) {
91
- return Math.round(ms / s) + 's';
92
- }
93
- return ms + 'ms';
94
- }
95
- function fmtLong(ms) {
96
- var msAbs = Math.abs(ms);
97
- if (msAbs >= d) {
98
- return plural(ms, msAbs, d, 'day');
99
- }
100
- if (msAbs >= h) {
101
- return plural(ms, msAbs, h, 'hour');
102
- }
103
- if (msAbs >= m) {
104
- return plural(ms, msAbs, m, 'minute');
105
- }
106
- if (msAbs >= s) {
107
- return plural(ms, msAbs, s, 'second');
108
- }
109
- return ms + ' ms';
110
- }
111
- function plural(ms, msAbs, n, name) {
112
- var isPlural = msAbs >= n * 1.5;
113
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
114
- }
115
- function setup(env) {
116
- createDebug.debug = createDebug;
117
- createDebug.default = createDebug;
118
- createDebug.coerce = coerce;
119
- createDebug.disable = disable;
120
- createDebug.enable = enable;
121
- createDebug.enabled = enabled;
122
- createDebug.humanize = ms;
123
- createDebug.destroy = destroy;
124
- Object.keys(env).forEach(key => {
125
- createDebug[key] = env[key];
126
- });
127
- createDebug.names = [];
128
- createDebug.skips = [];
129
- createDebug.formatters = {};
130
- function selectColor(namespace) {
131
- let hash = 0;
132
- for (let i = 0; i < namespace.length; i++) {
133
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
134
- hash |= 0;
135
- }
136
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
137
- }
138
- createDebug.selectColor = selectColor;
139
- function createDebug(namespace) {
140
- let prevTime;
141
- let enableOverride = null;
142
- function debug(...args) {
143
- if (!debug.enabled) {
144
- return;
145
- }
146
- const self = debug;
147
- const curr = Number(new Date());
148
- const ms = curr - (prevTime || curr);
149
- self.diff = ms;
150
- self.prev = prevTime;
151
- self.curr = curr;
152
- prevTime = curr;
153
- args[0] = createDebug.coerce(args[0]);
154
- if (typeof args[0] !== 'string') {
155
- args.unshift('%O');
156
- }
157
- let index = 0;
158
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
159
- if (match === '%%') {
160
- return '%';
161
- }
162
- index++;
163
- const formatter = createDebug.formatters[format];
164
- if (typeof formatter === 'function') {
165
- const val = args[index];
166
- match = formatter.call(self, val);
167
- args.splice(index, 1);
168
- index--;
169
- }
170
- return match;
171
- });
172
- createDebug.formatArgs.call(self, args);
173
- const logFn = self.log || createDebug.log;
174
- logFn.apply(self, args);
175
- }
176
- debug.namespace = namespace;
177
- debug.useColors = createDebug.useColors();
178
- debug.color = createDebug.selectColor(namespace);
179
- debug.extend = extend;
180
- debug.destroy = createDebug.destroy;
181
- Object.defineProperty(debug, 'enabled', {
182
- enumerable: true,
183
- configurable: false,
184
- get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
185
- set: v => {
186
- enableOverride = v;
187
- }
188
- });
189
- if (typeof createDebug.init === 'function') {
190
- createDebug.init(debug);
191
- }
192
- return debug;
193
- }
194
- function extend(namespace, delimiter) {
195
- const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
196
- newDebug.log = this.log;
197
- return newDebug;
198
- }
199
- function enable(namespaces) {
200
- createDebug.save(namespaces);
201
- createDebug.names = [];
202
- createDebug.skips = [];
203
- let i;
204
- const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
205
- const len = split.length;
206
- for (i = 0; i < len; i++) {
207
- if (!split[i]) {
208
- continue;
209
- }
210
- namespaces = split[i].replace(/\*/g, '.*?');
211
- if (namespaces[0] === '-') {
212
- createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
213
- } else {
214
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
215
- }
216
- }
217
- }
218
- function disable() {
219
- const namespaces = [...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)].join(',');
220
- createDebug.enable('');
221
- return namespaces;
222
- }
223
- function enabled(name) {
224
- if (name[name.length - 1] === '*') {
225
- return true;
226
- }
227
- let i;
228
- let len;
229
- for ((i = 0, len = createDebug.skips.length); i < len; i++) {
230
- if (createDebug.skips[i].test(name)) {
231
- return false;
232
- }
233
- }
234
- for ((i = 0, len = createDebug.names.length); i < len; i++) {
235
- if (createDebug.names[i].test(name)) {
236
- return true;
237
- }
238
- }
239
- return false;
240
- }
241
- function toNamespace(regexp) {
242
- return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
243
- }
244
- function coerce(val) {
245
- if (val instanceof Error) {
246
- return val.stack || val.message;
247
- }
248
- return val;
249
- }
250
- function destroy() {
251
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
252
- }
253
- createDebug.enable(createDebug.load());
254
- return createDebug;
255
- }
256
- var common = setup;
257
- var browser = createCommonjsModule(function (module, exports) {
258
- exports.formatArgs = formatArgs;
259
- exports.save = save;
260
- exports.load = load;
261
- exports.useColors = useColors;
262
- exports.storage = localstorage();
263
- exports.destroy = (() => {
264
- let warned = false;
265
- return () => {
266
- if (!warned) {
267
- warned = true;
268
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
269
- }
270
- };
271
- })();
272
- 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'];
273
- function useColors() {
274
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
275
- return true;
276
- }
277
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
278
- return false;
279
- }
280
- 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+)/);
281
- }
282
- function formatArgs(args) {
283
- args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
284
- if (!this.useColors) {
285
- return;
286
- }
287
- const c = 'color: ' + this.color;
288
- args.splice(1, 0, c, 'color: inherit');
289
- let index = 0;
290
- let lastC = 0;
291
- args[0].replace(/%[a-zA-Z%]/g, match => {
292
- if (match === '%%') {
293
- return;
294
- }
295
- index++;
296
- if (match === '%c') {
297
- lastC = index;
298
- }
299
- });
300
- args.splice(lastC, 0, c);
301
- }
302
- exports.log = console.debug || console.log || (() => {});
303
- function save(namespaces) {
304
- try {
305
- if (namespaces) {
306
- exports.storage.setItem('debug', namespaces);
307
- } else {
308
- exports.storage.removeItem('debug');
309
- }
310
- } catch (error) {}
311
- }
312
- function load() {
313
- let r;
314
- try {
315
- r = exports.storage.getItem('debug');
316
- } catch (error) {}
317
- if (!r && typeof process !== 'undefined' && ('env' in process)) {
318
- r = process.env.DEBUG;
319
- }
320
- return r;
321
- }
322
- function localstorage() {
323
- try {
324
- return localStorage;
325
- } catch (error) {}
326
- }
327
- module.exports = common(exports);
328
- const {formatters} = module.exports;
329
- formatters.j = function (v) {
330
- try {
331
- return JSON.stringify(v);
332
- } catch (error) {
333
- return '[UnexpectedJSONParseError]: ' + error.message;
334
- }
335
- };
336
- });
337
- browser.formatArgs;
338
- browser.save;
339
- browser.load;
340
- browser.useColors;
341
- browser.storage;
342
- browser.destroy;
343
- browser.colors;
344
- browser.log;
345
- var classnames = createCommonjsModule(function (module) {
346
- (function () {
347
- var hasOwn = ({}).hasOwnProperty;
348
- function classNames() {
349
- var classes = [];
350
- for (var i = 0; i < arguments.length; i++) {
351
- var arg = arguments[i];
352
- if (!arg) continue;
353
- var argType = typeof arg;
354
- if (argType === 'string' || argType === 'number') {
355
- classes.push(arg);
356
- } else if (Array.isArray(arg) && arg.length) {
357
- var inner = classNames.apply(null, arg);
358
- if (inner) {
359
- classes.push(inner);
360
- }
361
- } else if (argType === 'object') {
362
- for (var key in arg) {
363
- if (hasOwn.call(arg, key) && arg[key]) {
364
- classes.push(key);
365
- }
366
- }
367
- }
368
- }
369
- return classes.join(' ');
370
- }
371
- if (module.exports) {
372
- classNames.default = classNames;
373
- module.exports = classNames;
374
- } else {
375
- window.classNames = classNames;
376
- }
377
- })();
378
- });
379
- const React = _dll_react;
380
- const PropTypes = _dll_prop_types;
381
- const {withStyles: withStyles} = _dll_material_ui__core_styles;
382
- const {TextField: TextField} = _dll_material_ui__core;
383
- const {Typography: Typography} = _dll_material_ui__core;
384
- const {get: get} = _dll_lodash;
385
- const {set: set} = _dll_lodash;
386
- const {NumberTextField: NumberTextField} = _dll_pie_lib__config_ui;
387
- const {GraphContainer: GraphContainer} = _dll_pie_lib__graphing;
388
- const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/packages/graphing/configure/src/graphing-config.jsx";
389
- const AuthoringColumn = ({columnKey, axis, classes, model}) => {
390
- const rows = [{
391
- key: '${columnKey}-min-max',
392
- inputs: [{
393
- key: `${columnKey}.min`,
394
- label: 'Min value',
395
- className: classes.smallInput
396
- }, {
397
- key: `${columnKey}.max`,
398
- label: 'Max value',
399
- className: classes.smallInput
400
- }]
401
- }, {
402
- key: `${columnKey}-tick-frequency`,
403
- inputs: [{
404
- key: `${columnKey}.step`,
405
- label: 'Tick frequency'
406
- }]
407
- }, {
408
- key: `${columnKey}-tick-label-frequency`,
409
- inputs: [{
410
- key: `${columnKey}.labelStep`,
411
- label: 'Tick label frequency'
412
- }]
413
- }, {
414
- key: `${columnKey}-axis-label`,
415
- inputs: [{
416
- type: 'text',
417
- key: `${axis}-axis-label-input`,
418
- label: `${axis} Axis Label`
419
- }]
420
- }];
421
- return React.createElement('div', {
422
- className: classes.column,
423
- key: columnKey,
424
- __self: undefined,
425
- __source: {
426
- fileName: _jsxFileName,
427
- lineNumber: 58
428
- }
429
- }, `${columnKey.toUpperCase()} (${axis.toUpperCase()})`, rows.map(row => React.createElement('div', {
430
- className: classes.row,
431
- key: row.key,
432
- __self: undefined,
433
- __source: {
434
- fileName: _jsxFileName,
435
- lineNumber: 62
436
- }
437
- }, row.inputs.map(input => {
438
- if (input.type === 'text') {
439
- return React.createElement(TextField, {
440
- className: classes.input,
441
- label: input.label.toUpperCase(),
442
- value: model[`${axis}AxisLabel`],
443
- onChange: ({target}) => undefined.onChangeInputValue(`${axis}AxisLabel`, target.value),
444
- __self: undefined,
445
- __source: {
446
- fileName: _jsxFileName,
447
- lineNumber: 66
448
- }
449
- });
450
- }
451
- return React.createElement(TextField, {
452
- type: "number",
453
- key: input.key,
454
- label: input.label.toUpperCase(),
455
- onChange: (event, value) => undefined.onChangeInputValue(input.key, value),
456
- value: get(model, input.key),
457
- className: input.className || classes.input,
458
- __self: undefined,
459
- __source: {
460
- fileName: _jsxFileName,
461
- lineNumber: 76
462
- }
463
- });
464
- }))));
465
- };
466
- AuthoringColumn.propTypes = {
467
- axis: PropTypes.String,
468
- classes: PropTypes.object,
469
- columnKey: PropTypes.String,
470
- model: PropTypes.object
471
- };
472
- const styles = theme => ({
473
- container: {
474
- marginTop: theme.spacing.unit * 3,
475
- marginBottom: theme.spacing.unit * 3,
476
- display: 'flex',
477
- flex: 1
478
- },
479
- column: {
480
- flex: 1
481
- },
482
- row: {
483
- marginTop: theme.spacing.unit * 2,
484
- flex: 1
485
- },
486
- settings: {
487
- display: 'flex',
488
- flexDirection: 'row'
489
- },
490
- input: {
491
- width: 'calc(100% - 32px)'
492
- },
493
- smallInput: {
494
- width: 'calc(50% - 32px)'
495
- }
496
- });
497
- class GraphingConfig extends React.Component {
498
- constructor(...args) {
499
- super(...args);
500
- GraphingConfig.prototype.__init.call(this);
501
- GraphingConfig.prototype.__init2.call(this);
502
- GraphingConfig.prototype.__init3.call(this);
503
- GraphingConfig.prototype.__init4.call(this);
504
- }
505
- static __initStatic() {
506
- this.propTypes = {
507
- classes: PropTypes.object.isRequired,
508
- model: PropTypes.object.isRequired,
509
- onChange: PropTypes.func.isRequired,
510
- authoringEnabled: PropTypes.bool
511
- };
512
- }
513
- __init() {
514
- this.onChangeInputValue = (key, value) => {
515
- const {model} = this.props;
516
- set(model, key, value);
517
- this.props.onChange(model);
518
- };
519
- }
520
- __init2() {
521
- this.renderInput = (key, label, className) => {
522
- const {classes, model} = this.props;
523
- return React.createElement(NumberTextField, {
524
- key: key,
525
- label: label.toUpperCase(),
526
- onChange: (event, value) => this.onChangeInputValue(key, value),
527
- value: get(model, key),
528
- className: className || classes.input,
529
- __self: this,
530
- __source: {
531
- fileName: _jsxFileName,
532
- lineNumber: 158
533
- }
534
- });
535
- };
536
- }
537
- __init3() {
538
- this.renderRow = (key, content) => {
539
- const {classes} = this.props;
540
- return React.createElement('div', {
541
- className: classes.row,
542
- key: key,
543
- __self: this,
544
- __source: {
545
- fileName: _jsxFileName,
546
- lineNumber: 158
547
- }
548
- }, content);
549
- };
550
- }
551
- __init4() {
552
- this.changeBackgroundMarks = backgroundMarks => {
553
- const model = {
554
- ...this.props.model,
555
- backgroundMarks
556
- };
557
- this.props.onChange(model);
558
- };
559
- }
560
- render() {
561
- const {classes, model, authoringEnabled} = this.props;
562
- let {graph} = model || ({});
563
- const {arrows, backgroundMarks, domain, labels, range, title, toolbarTools} = model || ({});
564
- graph = graph || ({});
565
- return React.createElement('div', {
566
- __self: this,
567
- __source: {
568
- fileName: _jsxFileName,
569
- lineNumber: 176
570
- }
571
- }, "Define Graph Attributes", React.createElement('div', {
572
- className: classes.container,
573
- __self: this,
574
- __source: {
575
- fileName: _jsxFileName,
576
- lineNumber: 179
577
- }
578
- }, authoringEnabled && React.createElement('div', {
579
- className: classnames(classes.column, classes.settings),
580
- key: "settings",
581
- __self: this,
582
- __source: {
583
- fileName: _jsxFileName,
584
- lineNumber: 182
585
- }
586
- }, React.createElement(AuthoringColumn, {
587
- columnKey: "domain",
588
- axis: "x",
589
- classes: classes,
590
- model: model,
591
- __self: this,
592
- __source: {
593
- fileName: _jsxFileName,
594
- lineNumber: 183
595
- }
596
- }), React.createElement(AuthoringColumn, {
597
- columnKey: "range",
598
- axis: "y",
599
- classes: classes,
600
- model: model,
601
- __self: this,
602
- __source: {
603
- fileName: _jsxFileName,
604
- lineNumber: 184
605
- }
606
- })), React.createElement('div', {
607
- className: classes.column,
608
- key: "graph",
609
- __self: this,
610
- __source: {
611
- fileName: _jsxFileName,
612
- lineNumber: 189
613
- }
614
- }, React.createElement(Typography, {
615
- component: "div",
616
- type: "body1",
617
- __self: this,
618
- __source: {
619
- fileName: _jsxFileName,
620
- lineNumber: 190
621
- }
622
- }, React.createElement('span', {
623
- __self: this,
624
- __source: {
625
- fileName: _jsxFileName,
626
- lineNumber: 191
627
- }
628
- }, "Use the tools below to set background shapes")), React.createElement(GraphContainer, {
629
- axesSettings: {
630
- includeArrows: arrows
631
- },
632
- backgroundMarks: [],
633
- domain: domain,
634
- key: "graphing-config",
635
- labels: labels,
636
- marks: backgroundMarks,
637
- onChangeMarks: this.changeBackgroundMarks,
638
- range: range,
639
- size: {
640
- width: graph.width,
641
- height: graph.height
642
- },
643
- title: title,
644
- toolbarTools: toolbarTools,
645
- __self: this,
646
- __source: {
647
- fileName: _jsxFileName,
648
- lineNumber: 194
649
- }
650
- }))));
651
- }
652
- }
653
- GraphingConfig.__initStatic();
654
- var GraphingConfig$1 = withStyles(styles)(GraphingConfig);
655
- const React$1 = _dll_react;
656
- const PropTypes$1 = _dll_prop_types;
657
- const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
658
- const {set: set$1} = _dll_lodash;
659
- const {GraphContainer: Graph} = _dll_pie_lib__graphing;
660
- const {tools: tools} = _dll_pie_lib__graphing;
661
- const _jsxFileName$1 = "/home/ede/dev/github/pie-framework/pie-elements/packages/graphing/configure/src/correct-response.jsx";
662
- const {allTools} = tools;
663
- const styles$1 = theme => ({
664
- column: {
665
- flex: 1
666
- },
667
- graphingTools: {
668
- marginTop: theme.spacing.unit * 3,
669
- color: '#ababab'
670
- },
671
- availableTools: {
672
- marginTop: theme.spacing.unit * 3,
673
- marginBottom: theme.spacing.unit * 3,
674
- display: 'flex'
675
- },
676
- availableTool: {
677
- cursor: 'pointer',
678
- margin: theme.spacing.unit,
679
- padding: theme.spacing.unit,
680
- textTransform: 'capitalize'
681
- },
682
- selectedTool: {
683
- background: '#d8d8d8',
684
- border: '2px solid #ababab'
685
- },
686
- container: {
687
- border: '2px solid #ababab',
688
- borderRadius: '4px',
689
- padding: `${theme.spacing.unit * 2}px ${theme.spacing.unit * 4}px`,
690
- background: '#fafafa'
691
- },
692
- button: {
693
- marginTop: theme.spacing.unit * 3,
694
- cursor: 'pointer',
695
- background: '#eee',
696
- padding: theme.spacing.unit * 2,
697
- width: 'fit-content',
698
- borderRadius: '4px'
699
- }
700
- });
701
- const Tools = ({classes, toolbarTools, toggleToolBarTool}) => {
702
- const allToolsNoLabel = (allTools || []).filter(tool => tool !== 'label');
703
- return React$1.createElement('div', {
704
- className: classes.graphingTools,
705
- __self: undefined,
706
- __source: {
707
- fileName: _jsxFileName$1,
708
- lineNumber: 55
709
- }
710
- }, "GRAPHING TOOLS", React$1.createElement('div', {
711
- className: classes.availableTools,
712
- __self: undefined,
713
- __source: {
714
- fileName: _jsxFileName$1,
715
- lineNumber: 58
716
- }
717
- }, [...allToolsNoLabel, 'label'].map(tool => {
718
- const selected = toolbarTools.find(t => t === tool);
719
- return React$1.createElement('div', {
720
- key: tool,
721
- className: classnames(classes.availableTool, selected && classes.selectedTool),
722
- onClick: () => toggleToolBarTool(tool),
723
- __self: undefined,
724
- __source: {
725
- fileName: _jsxFileName$1,
726
- lineNumber: 63
727
- }
728
- }, tool.toUpperCase());
729
- })));
730
- };
731
- Tools.propTypes = {
732
- classes: PropTypes$1.object.isRequired,
733
- toolbarTools: PropTypes$1.arrayOf(PropTypes$1.string),
734
- toggleToolBarTool: PropTypes$1.func
735
- };
736
- class CorrectResponse extends React$1.Component {
737
- constructor(...args) {
738
- super(...args);
739
- CorrectResponse.prototype.__init.call(this);
740
- CorrectResponse.prototype.__init2.call(this);
741
- CorrectResponse.prototype.__init3.call(this);
742
- CorrectResponse.prototype.__init4.call(this);
743
- }
744
- static __initStatic() {
745
- this.propTypes = {
746
- classes: PropTypes$1.object.isRequired,
747
- model: PropTypes$1.object.isRequired,
748
- onChange: PropTypes$1.func.isRequired,
749
- toolbarTools: PropTypes$1.arrayOf(PropTypes$1.String)
750
- };
751
- }
752
- __init() {
753
- this.changeMarks = (key, marks) => {
754
- const {model, onChange} = this.props;
755
- set$1(model, `answers.${key}.marks`, marks);
756
- onChange(model);
757
- };
758
- }
759
- __init2() {
760
- this.changeToolbarTools = toolbarTools => {
761
- const {model, onChange} = this.props;
762
- model.toolbarTools = toolbarTools;
763
- onChange(model);
764
- };
765
- }
766
- __init3() {
767
- this.toggleToolBarTool = tool => {
768
- const {toolbarTools} = this.props.model;
769
- const index = toolbarTools.findIndex(t => tool === t);
770
- if (index >= 0) {
771
- const update = [...toolbarTools];
772
- update.splice(index, 1);
773
- this.changeToolbarTools(update);
774
- } else {
775
- this.changeToolbarTools([...toolbarTools, tool]);
776
- }
777
- };
778
- }
779
- __init4() {
780
- this.addAlternateResponse = () => {
781
- const {model, onChange} = this.props;
782
- const {answers} = model || ({});
783
- const answersKeys = Object.keys(answers || ({}));
784
- set$1(model, `answers.${`alternate${answersKeys.length}`}`, {
785
- name: `Alternate ${answersKeys.length}`,
786
- marks: []
787
- });
788
- onChange(model);
789
- };
790
- }
791
- render() {
792
- const {classes, model} = this.props;
793
- let {graph} = model || ({});
794
- const {answers, arrows, backgroundMarks, domain, labels, range, title, toolbarTools} = model || ({});
795
- graph = graph || ({});
796
- const answersKeys = Object.keys(answers || ({}));
797
- return React$1.createElement('div', {
798
- __self: this,
799
- __source: {
800
- fileName: _jsxFileName$1,
801
- lineNumber: 144
802
- }
803
- }, "Define Correct Response", React$1.createElement(Tools, {
804
- classes: classes,
805
- toggleToolBarTool: this.toggleToolBarTool,
806
- toolbarTools: toolbarTools,
807
- __self: this,
808
- __source: {
809
- fileName: _jsxFileName$1,
810
- lineNumber: 146
811
- }
812
- }), React$1.createElement('div', {
813
- className: classes.container,
814
- __self: this,
815
- __source: {
816
- fileName: _jsxFileName$1,
817
- lineNumber: 152
818
- }
819
- }, answersKeys.map(mark => {
820
- const {marks, name} = answers[mark] || ({});
821
- return React$1.createElement('div', {
822
- key: `correct-response-graph-${name}`,
823
- __self: this,
824
- __source: {
825
- fileName: _jsxFileName$1,
826
- lineNumber: 157
827
- }
828
- }, React$1.createElement('p', {
829
- __self: this,
830
- __source: {
831
- fileName: _jsxFileName$1,
832
- lineNumber: 158
833
- }
834
- }, name), React$1.createElement(Graph, {
835
- axesSettings: {
836
- includeArrows: arrows
837
- },
838
- backgroundMarks: backgroundMarks,
839
- domain: domain,
840
- labels: labels,
841
- marks: marks,
842
- onChangeMarks: newMarks => this.changeMarks(mark, newMarks),
843
- range: range,
844
- size: {
845
- width: graph.width,
846
- height: graph.height
847
- },
848
- title: title,
849
- toolbarTools: toolbarTools,
850
- __self: this,
851
- __source: {
852
- fileName: _jsxFileName$1,
853
- lineNumber: 160
854
- }
855
- }));
856
- }), React$1.createElement('div', {
857
- className: classes.button,
858
- onClick: this.addAlternateResponse,
859
- __self: this,
860
- __source: {
861
- fileName: _jsxFileName$1,
862
- lineNumber: 176
863
- }
864
- }, "ADD ALTERNATE")));
865
- }
866
- }
867
- CorrectResponse.__initStatic();
868
- var CorrectResponse$1 = withStyles$1(styles$1)(CorrectResponse);
869
- const React$2 = _dll_react;
870
- const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
871
- const PropTypes$2 = _dll_prop_types;
872
- const {Typography: Typography$1} = _dll_material_ui__core;
873
- const {settings: settings} = _dll_pie_lib__config_ui;
874
- const {layout: layout} = _dll_pie_lib__config_ui;
875
- const {InputContainer: InputContainer} = _dll_pie_lib__config_ui;
876
- const EditableHtml = _dll_pie_lib__editable_html;
877
- const _jsxFileName$2 = "/home/ede/dev/github/pie-framework/pie-elements/packages/graphing/configure/src/configure.jsx";
878
- const {Panel, toggle, radio} = settings;
879
- const log = browser('@pie-element:graphing:configure');
880
- const styles$2 = theme => ({
881
- title: {
882
- fontSize: '1.1rem',
883
- display: 'block',
884
- marginTop: theme.spacing.unit * 2,
885
- marginBottom: theme.spacing.unit
886
- },
887
- content: {
888
- marginTop: theme.spacing.unit * 2
889
- },
890
- promptHolder: {
891
- width: '100%',
892
- paddingBottom: theme.spacing.unit * 2,
893
- marginBottom: theme.spacing.unit * 2,
894
- marginTop: theme.spacing.unit * 2
895
- },
896
- prompt: {
897
- paddingTop: theme.spacing.unit * 2,
898
- width: '100%'
899
- }
900
- });
901
- class Configure extends React$2.Component {
902
- constructor(...args) {
903
- super(...args);
904
- Configure.prototype.__init.call(this);
905
- Configure.prototype.__init2.call(this);
906
- Configure.prototype.__init3.call(this);
907
- }
908
- static __initStatic() {
909
- this.propTypes = {
910
- onModelChanged: PropTypes$2.func,
911
- onConfigurationChanged: PropTypes$2.func,
912
- classes: PropTypes$2.object,
913
- imageSupport: PropTypes$2.object,
914
- model: PropTypes$2.object.isRequired,
915
- configuration: PropTypes$2.object.isRequired
916
- };
917
- }
918
- static __initStatic2() {
919
- this.defaultProps = {
920
- classes: {}
921
- };
922
- }
923
- __init() {
924
- this.onRationaleChange = rationale => {
925
- const {onModelChanged, model} = this.props;
926
- onModelChanged({
927
- ...model,
928
- rationale
929
- });
930
- };
931
- }
932
- __init2() {
933
- this.onPromptChange = prompt => {
934
- const {onModelChanged, model} = this.props;
935
- onModelChanged({
936
- ...model,
937
- prompt
938
- });
939
- };
940
- }
941
- __init3() {
942
- this.onTeacherInstructionsChange = teacherInstructions => {
943
- const {onModelChanged, model} = this.props;
944
- onModelChanged({
945
- ...model,
946
- teacherInstructions
947
- });
948
- };
949
- }
950
- render() {
951
- const {classes, model, configuration, onConfigurationChanged, onModelChanged, imageSupport} = this.props;
952
- const config = model.graph;
953
- const {arrows = {}, title = {}, padding = {}, labels = {}, rationale = {}, scoringType = {}, studentInstructions = {}, teacherInstructions = {}, prompt = {}, authoring = {}} = configuration || ({});
954
- log('[render] model', model);
955
- const {teacherInstructionsEnabled, promptEnabled, rationaleEnabled} = model || ({});
956
- return React$2.createElement(layout.ConfigLayout, {
957
- settings: React$2.createElement(Panel, {
958
- model: model,
959
- configuration: configuration,
960
- onChangeModel: onModelChanged,
961
- onChangeConfiguration: onConfigurationChanged,
962
- groups: {
963
- 'Item Type': {
964
- arrows: arrows.settings && toggle(arrows.label),
965
- 'title.enabled': title.settings && toggle(title.label, true),
966
- padding: padding.settings && toggle(padding.label),
967
- labels: labels.settings && toggle(labels.label)
968
- },
969
- Properties: {
970
- 'authoring.enabled': authoring.settings && toggle(authoring.label, true),
971
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
972
- studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
973
- promptEnabled: prompt.settings && toggle(prompt.label),
974
- rationaleEnabled: rationale.settings && toggle(rationale.label),
975
- scoringType: scoringType.settings && radio(scoringType.label, ['dichotomous', 'partial scoring'])
976
- }
977
- },
978
- __self: this,
979
- __source: {
980
- fileName: _jsxFileName$2,
981
- lineNumber: 97
982
- }
983
- }),
984
- __self: this,
985
- __source: {
986
- fileName: _jsxFileName$2,
987
- lineNumber: 95
988
- }
989
- }, React$2.createElement('div', {
990
- className: classes.content,
991
- __self: this,
992
- __source: {
993
- fileName: _jsxFileName$2,
994
- lineNumber: 128
995
- }
996
- }, React$2.createElement(Typography$1, {
997
- component: "div",
998
- type: "body1",
999
- __self: this,
1000
- __source: {
1001
- fileName: _jsxFileName$2,
1002
- lineNumber: 129
1003
- }
1004
- }, React$2.createElement('span', {
1005
- __self: this,
1006
- __source: {
1007
- fileName: _jsxFileName$2,
1008
- lineNumber: 130
1009
- }
1010
- }, "This interaction asks a student to draw a line that meets specific criteria. The student will draw the line by clicking on two points on the graph.")), teacherInstructionsEnabled && React$2.createElement(InputContainer, {
1011
- label: teacherInstructions.label,
1012
- className: classes.promptHolder,
1013
- __self: this,
1014
- __source: {
1015
- fileName: _jsxFileName$2,
1016
- lineNumber: 138
1017
- }
1018
- }, React$2.createElement(EditableHtml, {
1019
- className: classes.prompt,
1020
- markup: model.teacherInstructions || '',
1021
- onChange: this.onTeacherInstructionsChange,
1022
- imageSupport: imageSupport,
1023
- nonEmpty: false,
1024
- __self: this,
1025
- __source: {
1026
- fileName: _jsxFileName$2,
1027
- lineNumber: 142
1028
- }
1029
- })), promptEnabled && React$2.createElement(InputContainer, {
1030
- label: prompt.label,
1031
- className: classes.promptHolder,
1032
- __self: this,
1033
- __source: {
1034
- fileName: _jsxFileName$2,
1035
- lineNumber: 153
1036
- }
1037
- }, React$2.createElement(EditableHtml, {
1038
- className: classes.prompt,
1039
- markup: model.prompt,
1040
- onChange: this.onPromptChange,
1041
- imageSupport: imageSupport,
1042
- nonEmpty: false,
1043
- disableUnderline: true,
1044
- __self: this,
1045
- __source: {
1046
- fileName: _jsxFileName$2,
1047
- lineNumber: 157
1048
- }
1049
- })), rationaleEnabled && React$2.createElement(InputContainer, {
1050
- label: rationale.label || 'Rationale',
1051
- className: classes.promptHolder,
1052
- __self: this,
1053
- __source: {
1054
- fileName: _jsxFileName$2,
1055
- lineNumber: 169
1056
- }
1057
- }, React$2.createElement(EditableHtml, {
1058
- className: classes.prompt,
1059
- markup: model.rationale || '',
1060
- onChange: this.onRationaleChange,
1061
- imageSupport: imageSupport,
1062
- __self: this,
1063
- __source: {
1064
- fileName: _jsxFileName$2,
1065
- lineNumber: 173
1066
- }
1067
- })), React$2.createElement(GraphingConfig$1, {
1068
- authoringEnabled: authoring && authoring.enabled,
1069
- config: config,
1070
- model: model,
1071
- onChange: this.props.onModelChanged,
1072
- __self: this,
1073
- __source: {
1074
- fileName: _jsxFileName$2,
1075
- lineNumber: 182
1076
- }
1077
- }), React$2.createElement(CorrectResponse$1, {
1078
- config: config,
1079
- model: model,
1080
- onChange: this.props.onModelChanged,
1081
- __self: this,
1082
- __source: {
1083
- fileName: _jsxFileName$2,
1084
- lineNumber: 189
1085
- }
1086
- })));
1087
- }
1088
- }
1089
- Configure.__initStatic();
1090
- Configure.__initStatic2();
1091
- var Configure$1 = withStyles$2(styles$2)(Configure);
1092
- const {tools: tools$1} = _dll_pie_lib__graphing;
1093
- const {allTools: allTools$1 = []} = tools$1;
1094
- var defaultValues = {
1095
- model: {
1096
- answers: {},
1097
- arrows: true,
1098
- backgroundMarks: [],
1099
- domain: {
1100
- min: -5,
1101
- max: 5,
1102
- step: 1,
1103
- labelStep: 1,
1104
- axisLabel: 'x'
1105
- },
1106
- graph: {
1107
- width: 500,
1108
- height: 500
1109
- },
1110
- labels: {},
1111
- padding: true,
1112
- prompt: '',
1113
- range: {
1114
- min: -5,
1115
- max: 5,
1116
- step: 1,
1117
- labelStep: 1,
1118
- axisLabel: 'y'
1119
- },
1120
- rationale: '',
1121
- title: '',
1122
- toolbarTools: allTools$1,
1123
- promptEnabled: true,
1124
- rationaleEnabled: true,
1125
- teacherInstructionsEnabled: true,
1126
- studentInstructionsEnabled: true
1127
- },
1128
- configuration: {
1129
- authoring: {
1130
- settings: false,
1131
- label: 'Allow authoring',
1132
- enabled: false
1133
- },
1134
- arrows: {
1135
- settings: false,
1136
- label: 'Include arrows'
1137
- },
1138
- padding: {
1139
- settings: false,
1140
- label: 'Padding'
1141
- },
1142
- labels: {
1143
- settings: false,
1144
- label: 'Labels',
1145
- enabled: true
1146
- },
1147
- prompt: {
1148
- settings: true,
1149
- label: 'Item Stem'
1150
- },
1151
- rationale: {
1152
- settings: true,
1153
- label: 'Rationale'
1154
- },
1155
- scoringType: {
1156
- settings: false,
1157
- label: 'Scoring Type'
1158
- },
1159
- studentInstructions: {
1160
- settings: false,
1161
- label: 'Student Instructions'
1162
- },
1163
- teacherInstructions: {
1164
- settings: true,
1165
- label: 'Teacher Instructions'
1166
- },
1167
- title: {
1168
- settings: false,
1169
- label: 'Graph Title',
1170
- enabled: true
1171
- }
1172
- }
1173
- };
1174
- const React$3 = _dll_react;
1175
- const ReactDOM = _dll_react_dom;
1176
- const {isEmpty: isEmpty} = _dll_lodash;
1177
- const {DeleteImageEvent: DeleteImageEvent} = _dll_pie_framework__pie_configure_events;
1178
- const {InsertImageEvent: InsertImageEvent} = _dll_pie_framework__pie_configure_events;
1179
- const {ModelUpdatedEvent: ModelUpdatedEvent} = _dll_pie_framework__pie_configure_events;
1180
- const log$1 = browser('pie-elements:graphing:configure');
1181
- const sortedAnswers = answers => {
1182
- answers = answers || ({});
1183
- return Object.keys(answers).sort().reduce((result, key) => {
1184
- result[key] = answers[key];
1185
- return result;
1186
- }, {});
1187
- };
1188
- class GraphLinesConfigure extends HTMLElement {
1189
- static __initStatic() {
1190
- this.createDefaultModel = (model = {}) => {
1191
- if (!isEmpty(model.answers) && model.answers.hasOwnProperty('correctAnswer')) {
1192
- model.answers = Object.assign({
1193
- correctAnswer: model.answers.correctAnswer
1194
- }, sortedAnswers(model.answers));
1195
- }
1196
- return {
1197
- ...defaultValues.model,
1198
- ...model
1199
- };
1200
- };
1201
- }
1202
- constructor() {
1203
- super();
1204
- GraphLinesConfigure.prototype.__init.call(this);
1205
- GraphLinesConfigure.prototype.__init2.call(this);
1206
- GraphLinesConfigure.prototype.__init3.call(this);
1207
- GraphLinesConfigure.prototype.__init4.call(this);
1208
- this._model = GraphLinesConfigure.createDefaultModel();
1209
- this._configuration = defaultValues.configuration;
1210
- }
1211
- set model(m) {
1212
- this._model = GraphLinesConfigure.createDefaultModel(m);
1213
- this._render();
1214
- }
1215
- set configuration(c) {
1216
- this._configuration = c;
1217
- this._render();
1218
- }
1219
- __init() {
1220
- this.onModelChanged = model => {
1221
- this._model = model;
1222
- this._render();
1223
- log$1('[onModelChanged]: ', this._model);
1224
- this.dispatchEvent(new ModelUpdatedEvent(this._model, true));
1225
- };
1226
- }
1227
- __init2() {
1228
- this.onConfigurationChanged = config => {
1229
- this._configuration = config;
1230
- this._render();
1231
- };
1232
- }
1233
- __init3() {
1234
- this.insertImage = handler => {
1235
- this.dispatchEvent(new InsertImageEvent(handler));
1236
- };
1237
- }
1238
- __init4() {
1239
- this.onDeleteImage = (src, done) => {
1240
- this.dispatchEvent(new DeleteImageEvent(src, done));
1241
- };
1242
- }
1243
- _render() {
1244
- if (this._model) {
1245
- const el = React$3.createElement(Configure$1, {
1246
- onModelChanged: this.onModelChanged,
1247
- onConfigurationChanged: this.onConfigurationChanged,
1248
- model: this._model,
1249
- configuration: this._configuration,
1250
- imageSupport: {
1251
- add: this.insertImage,
1252
- delete: this.onDeleteImage
1253
- }
1254
- });
1255
- ReactDOM.render(el, this);
1256
- }
1257
- }
1258
- }
1259
- GraphLinesConfigure.__initStatic();
1260
- export default GraphLinesConfigure;