@pie-element/placement-ordering 7.5.2 → 7.5.3-next.1008
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +195 -0
- package/configure/CHANGELOG.md +169 -0
- package/configure/lib/choice-editor.js +229 -54
- package/configure/lib/choice-editor.js.map +1 -1
- package/configure/lib/choice-tile.js +69 -9
- package/configure/lib/choice-tile.js.map +1 -1
- package/configure/lib/defaults.js +20 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/design.js +131 -13
- package/configure/lib/design.js.map +1 -1
- package/configure/lib/index.js +3 -3
- package/configure/lib/utils.js +14 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +5 -4
- package/controller/CHANGELOG.md +49 -0
- package/controller/lib/index.js +42 -9
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/scoring.js +11 -4
- package/controller/lib/scoring.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +124 -0
- package/docs/config-schema.json.md +97 -1
- package/docs/demo/generate.js +3 -2
- package/docs/pie-schema.json +85 -26
- package/docs/pie-schema.json.md +62 -27
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/main.js +1 -1
- package/lib/main.js.map +1 -1
- package/lib/ordering.js +2 -1
- package/lib/ordering.js.map +1 -1
- package/lib/placement-ordering.js +12 -15
- package/lib/placement-ordering.js.map +1 -1
- package/lib/tile.js +1 -1
- package/lib/tile.js.map +1 -1
- package/lib/tiler.js +3 -3
- package/lib/tiler.js.map +1 -1
- package/package.json +5 -5
- package/module/configure.js +0 -1525
- package/module/controller.js +0 -20249
- package/module/demo.js +0 -79
- package/module/element.js +0 -1249
- package/module/index.html +0 -16
- package/module/manifest.json +0 -10
package/module/configure.js
DELETED
|
@@ -1,1525 +0,0 @@
|
|
|
1
|
-
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";
|
|
2
|
-
import {_dll_react, _dll_material_ui__core, _dll_react_dnd, _dll_prop_types, _dll_material_ui__core_styles, _dll_lodash, _dll_pie_lib__drag, _dll_react_dom} from "../../../@pie-ui/shared-lib@^4.3.3/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 s = 1000;
|
|
12
|
-
var m = s * 60;
|
|
13
|
-
var h = m * 60;
|
|
14
|
-
var d = h * 24;
|
|
15
|
-
var w = d * 7;
|
|
16
|
-
var y = d * 365.25;
|
|
17
|
-
var ms = function (val, options) {
|
|
18
|
-
options = options || ({});
|
|
19
|
-
var type = typeof val;
|
|
20
|
-
if (type === 'string' && val.length > 0) {
|
|
21
|
-
return parse(val);
|
|
22
|
-
} else if (type === 'number' && isFinite(val)) {
|
|
23
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
24
|
-
}
|
|
25
|
-
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
|
|
26
|
-
};
|
|
27
|
-
function parse(str) {
|
|
28
|
-
str = String(str);
|
|
29
|
-
if (str.length > 100) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
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);
|
|
33
|
-
if (!match) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
var n = parseFloat(match[1]);
|
|
37
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
38
|
-
switch (type) {
|
|
39
|
-
case 'years':
|
|
40
|
-
case 'year':
|
|
41
|
-
case 'yrs':
|
|
42
|
-
case 'yr':
|
|
43
|
-
case 'y':
|
|
44
|
-
return n * y;
|
|
45
|
-
case 'weeks':
|
|
46
|
-
case 'week':
|
|
47
|
-
case 'w':
|
|
48
|
-
return n * w;
|
|
49
|
-
case 'days':
|
|
50
|
-
case 'day':
|
|
51
|
-
case 'd':
|
|
52
|
-
return n * d;
|
|
53
|
-
case 'hours':
|
|
54
|
-
case 'hour':
|
|
55
|
-
case 'hrs':
|
|
56
|
-
case 'hr':
|
|
57
|
-
case 'h':
|
|
58
|
-
return n * h;
|
|
59
|
-
case 'minutes':
|
|
60
|
-
case 'minute':
|
|
61
|
-
case 'mins':
|
|
62
|
-
case 'min':
|
|
63
|
-
case 'm':
|
|
64
|
-
return n * m;
|
|
65
|
-
case 'seconds':
|
|
66
|
-
case 'second':
|
|
67
|
-
case 'secs':
|
|
68
|
-
case 'sec':
|
|
69
|
-
case 's':
|
|
70
|
-
return n * s;
|
|
71
|
-
case 'milliseconds':
|
|
72
|
-
case 'millisecond':
|
|
73
|
-
case 'msecs':
|
|
74
|
-
case 'msec':
|
|
75
|
-
case 'ms':
|
|
76
|
-
return n;
|
|
77
|
-
default:
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function fmtShort(ms) {
|
|
82
|
-
var msAbs = Math.abs(ms);
|
|
83
|
-
if (msAbs >= d) {
|
|
84
|
-
return Math.round(ms / d) + 'd';
|
|
85
|
-
}
|
|
86
|
-
if (msAbs >= h) {
|
|
87
|
-
return Math.round(ms / h) + 'h';
|
|
88
|
-
}
|
|
89
|
-
if (msAbs >= m) {
|
|
90
|
-
return Math.round(ms / m) + 'm';
|
|
91
|
-
}
|
|
92
|
-
if (msAbs >= s) {
|
|
93
|
-
return Math.round(ms / s) + 's';
|
|
94
|
-
}
|
|
95
|
-
return ms + 'ms';
|
|
96
|
-
}
|
|
97
|
-
function fmtLong(ms) {
|
|
98
|
-
var msAbs = Math.abs(ms);
|
|
99
|
-
if (msAbs >= d) {
|
|
100
|
-
return plural(ms, msAbs, d, 'day');
|
|
101
|
-
}
|
|
102
|
-
if (msAbs >= h) {
|
|
103
|
-
return plural(ms, msAbs, h, 'hour');
|
|
104
|
-
}
|
|
105
|
-
if (msAbs >= m) {
|
|
106
|
-
return plural(ms, msAbs, m, 'minute');
|
|
107
|
-
}
|
|
108
|
-
if (msAbs >= s) {
|
|
109
|
-
return plural(ms, msAbs, s, 'second');
|
|
110
|
-
}
|
|
111
|
-
return ms + ' ms';
|
|
112
|
-
}
|
|
113
|
-
function plural(ms, msAbs, n, name) {
|
|
114
|
-
var isPlural = msAbs >= n * 1.5;
|
|
115
|
-
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
116
|
-
}
|
|
117
|
-
function setup(env) {
|
|
118
|
-
createDebug.debug = createDebug;
|
|
119
|
-
createDebug.default = createDebug;
|
|
120
|
-
createDebug.coerce = coerce;
|
|
121
|
-
createDebug.disable = disable;
|
|
122
|
-
createDebug.enable = enable;
|
|
123
|
-
createDebug.enabled = enabled;
|
|
124
|
-
createDebug.humanize = ms;
|
|
125
|
-
Object.keys(env).forEach(function (key) {
|
|
126
|
-
createDebug[key] = env[key];
|
|
127
|
-
});
|
|
128
|
-
createDebug.instances = [];
|
|
129
|
-
createDebug.names = [];
|
|
130
|
-
createDebug.skips = [];
|
|
131
|
-
createDebug.formatters = {};
|
|
132
|
-
function selectColor(namespace) {
|
|
133
|
-
var hash = 0;
|
|
134
|
-
for (var i = 0; i < namespace.length; i++) {
|
|
135
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
136
|
-
hash |= 0;
|
|
137
|
-
}
|
|
138
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
139
|
-
}
|
|
140
|
-
createDebug.selectColor = selectColor;
|
|
141
|
-
function createDebug(namespace) {
|
|
142
|
-
var prevTime;
|
|
143
|
-
function debug() {
|
|
144
|
-
if (!debug.enabled) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
148
|
-
args[_key] = arguments[_key];
|
|
149
|
-
}
|
|
150
|
-
var self = debug;
|
|
151
|
-
var curr = Number(new Date());
|
|
152
|
-
var ms = curr - (prevTime || curr);
|
|
153
|
-
self.diff = ms;
|
|
154
|
-
self.prev = prevTime;
|
|
155
|
-
self.curr = curr;
|
|
156
|
-
prevTime = curr;
|
|
157
|
-
args[0] = createDebug.coerce(args[0]);
|
|
158
|
-
if (typeof args[0] !== 'string') {
|
|
159
|
-
args.unshift('%O');
|
|
160
|
-
}
|
|
161
|
-
var index = 0;
|
|
162
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
|
|
163
|
-
if (match === '%%') {
|
|
164
|
-
return match;
|
|
165
|
-
}
|
|
166
|
-
index++;
|
|
167
|
-
var formatter = createDebug.formatters[format];
|
|
168
|
-
if (typeof formatter === 'function') {
|
|
169
|
-
var val = args[index];
|
|
170
|
-
match = formatter.call(self, val);
|
|
171
|
-
args.splice(index, 1);
|
|
172
|
-
index--;
|
|
173
|
-
}
|
|
174
|
-
return match;
|
|
175
|
-
});
|
|
176
|
-
createDebug.formatArgs.call(self, args);
|
|
177
|
-
var logFn = self.log || createDebug.log;
|
|
178
|
-
logFn.apply(self, args);
|
|
179
|
-
}
|
|
180
|
-
debug.namespace = namespace;
|
|
181
|
-
debug.enabled = createDebug.enabled(namespace);
|
|
182
|
-
debug.useColors = createDebug.useColors();
|
|
183
|
-
debug.color = selectColor(namespace);
|
|
184
|
-
debug.destroy = destroy;
|
|
185
|
-
debug.extend = extend;
|
|
186
|
-
if (typeof createDebug.init === 'function') {
|
|
187
|
-
createDebug.init(debug);
|
|
188
|
-
}
|
|
189
|
-
createDebug.instances.push(debug);
|
|
190
|
-
return debug;
|
|
191
|
-
}
|
|
192
|
-
function destroy() {
|
|
193
|
-
var index = createDebug.instances.indexOf(this);
|
|
194
|
-
if (index !== -1) {
|
|
195
|
-
createDebug.instances.splice(index, 1);
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
function extend(namespace, delimiter) {
|
|
201
|
-
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
202
|
-
}
|
|
203
|
-
function enable(namespaces) {
|
|
204
|
-
createDebug.save(namespaces);
|
|
205
|
-
createDebug.names = [];
|
|
206
|
-
createDebug.skips = [];
|
|
207
|
-
var i;
|
|
208
|
-
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
209
|
-
var len = split.length;
|
|
210
|
-
for (i = 0; i < len; i++) {
|
|
211
|
-
if (!split[i]) {
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
|
215
|
-
if (namespaces[0] === '-') {
|
|
216
|
-
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|
217
|
-
} else {
|
|
218
|
-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
for (i = 0; i < createDebug.instances.length; i++) {
|
|
222
|
-
var instance = createDebug.instances[i];
|
|
223
|
-
instance.enabled = createDebug.enabled(instance.namespace);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function disable() {
|
|
227
|
-
createDebug.enable('');
|
|
228
|
-
}
|
|
229
|
-
function enabled(name) {
|
|
230
|
-
if (name[name.length - 1] === '*') {
|
|
231
|
-
return true;
|
|
232
|
-
}
|
|
233
|
-
var i;
|
|
234
|
-
var len;
|
|
235
|
-
for ((i = 0, len = createDebug.skips.length); i < len; i++) {
|
|
236
|
-
if (createDebug.skips[i].test(name)) {
|
|
237
|
-
return false;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
for ((i = 0, len = createDebug.names.length); i < len; i++) {
|
|
241
|
-
if (createDebug.names[i].test(name)) {
|
|
242
|
-
return true;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return false;
|
|
246
|
-
}
|
|
247
|
-
function coerce(val) {
|
|
248
|
-
if (val instanceof Error) {
|
|
249
|
-
return val.stack || val.message;
|
|
250
|
-
}
|
|
251
|
-
return val;
|
|
252
|
-
}
|
|
253
|
-
createDebug.enable(createDebug.load());
|
|
254
|
-
return createDebug;
|
|
255
|
-
}
|
|
256
|
-
var common = setup;
|
|
257
|
-
var browser = createCommonjsModule(function (module, exports) {
|
|
258
|
-
function _typeof(obj) {
|
|
259
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
260
|
-
_typeof = function _typeof(obj) {
|
|
261
|
-
return typeof obj;
|
|
262
|
-
};
|
|
263
|
-
} else {
|
|
264
|
-
_typeof = function _typeof(obj) {
|
|
265
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
return _typeof(obj);
|
|
269
|
-
}
|
|
270
|
-
exports.log = log;
|
|
271
|
-
exports.formatArgs = formatArgs;
|
|
272
|
-
exports.save = save;
|
|
273
|
-
exports.load = load;
|
|
274
|
-
exports.useColors = useColors;
|
|
275
|
-
exports.storage = localstorage();
|
|
276
|
-
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'];
|
|
277
|
-
function useColors() {
|
|
278
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
279
|
-
return true;
|
|
280
|
-
}
|
|
281
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
282
|
-
return false;
|
|
283
|
-
}
|
|
284
|
-
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+)/);
|
|
285
|
-
}
|
|
286
|
-
function formatArgs(args) {
|
|
287
|
-
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
|
288
|
-
if (!this.useColors) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
var c = 'color: ' + this.color;
|
|
292
|
-
args.splice(1, 0, c, 'color: inherit');
|
|
293
|
-
var index = 0;
|
|
294
|
-
var lastC = 0;
|
|
295
|
-
args[0].replace(/%[a-zA-Z%]/g, function (match) {
|
|
296
|
-
if (match === '%%') {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
index++;
|
|
300
|
-
if (match === '%c') {
|
|
301
|
-
lastC = index;
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
args.splice(lastC, 0, c);
|
|
305
|
-
}
|
|
306
|
-
function log() {
|
|
307
|
-
var _console;
|
|
308
|
-
return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
|
|
309
|
-
}
|
|
310
|
-
function save(namespaces) {
|
|
311
|
-
try {
|
|
312
|
-
if (namespaces) {
|
|
313
|
-
exports.storage.setItem('debug', namespaces);
|
|
314
|
-
} else {
|
|
315
|
-
exports.storage.removeItem('debug');
|
|
316
|
-
}
|
|
317
|
-
} catch (error) {}
|
|
318
|
-
}
|
|
319
|
-
function load() {
|
|
320
|
-
var r;
|
|
321
|
-
try {
|
|
322
|
-
r = exports.storage.getItem('debug');
|
|
323
|
-
} catch (error) {}
|
|
324
|
-
if (!r && typeof process !== 'undefined' && ('env' in process)) {
|
|
325
|
-
r = process.env.DEBUG;
|
|
326
|
-
}
|
|
327
|
-
return r;
|
|
328
|
-
}
|
|
329
|
-
function localstorage() {
|
|
330
|
-
try {
|
|
331
|
-
return localStorage;
|
|
332
|
-
} catch (error) {}
|
|
333
|
-
}
|
|
334
|
-
module.exports = common(exports);
|
|
335
|
-
var formatters = module.exports.formatters;
|
|
336
|
-
formatters.j = function (v) {
|
|
337
|
-
try {
|
|
338
|
-
return JSON.stringify(v);
|
|
339
|
-
} catch (error) {
|
|
340
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
});
|
|
344
|
-
browser.log;
|
|
345
|
-
browser.formatArgs;
|
|
346
|
-
browser.save;
|
|
347
|
-
browser.load;
|
|
348
|
-
browser.useColors;
|
|
349
|
-
browser.storage;
|
|
350
|
-
browser.colors;
|
|
351
|
-
var nestedProperty = {
|
|
352
|
-
set: setNestedProperty,
|
|
353
|
-
get: getNestedProperty,
|
|
354
|
-
has: hasNestedProperty,
|
|
355
|
-
hasOwn: function (object, property, options) {
|
|
356
|
-
return this.has(object, property, options || ({
|
|
357
|
-
own: true
|
|
358
|
-
}));
|
|
359
|
-
},
|
|
360
|
-
isIn: isInNestedProperty
|
|
361
|
-
};
|
|
362
|
-
function getNestedProperty(object, property) {
|
|
363
|
-
if (object && typeof object == "object") {
|
|
364
|
-
if (typeof property == "string" && property !== "") {
|
|
365
|
-
var split = property.split(".");
|
|
366
|
-
return split.reduce(function (obj, prop) {
|
|
367
|
-
return obj && obj[prop];
|
|
368
|
-
}, object);
|
|
369
|
-
} else if (typeof property == "number") {
|
|
370
|
-
return object[property];
|
|
371
|
-
} else {
|
|
372
|
-
return object;
|
|
373
|
-
}
|
|
374
|
-
} else {
|
|
375
|
-
return object;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
function hasNestedProperty(object, property, options) {
|
|
379
|
-
options = options || ({});
|
|
380
|
-
if (object && typeof object == "object") {
|
|
381
|
-
if (typeof property == "string" && property !== "") {
|
|
382
|
-
var split = property.split(".");
|
|
383
|
-
return split.reduce(function (obj, prop, idx, array) {
|
|
384
|
-
if (idx == array.length - 1) {
|
|
385
|
-
if (options.own) {
|
|
386
|
-
return !!(obj && obj.hasOwnProperty(prop));
|
|
387
|
-
} else {
|
|
388
|
-
return !!(obj !== null && typeof obj == "object" && (prop in obj));
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
return obj && obj[prop];
|
|
392
|
-
}, object);
|
|
393
|
-
} else if (typeof property == "number") {
|
|
394
|
-
return (property in object);
|
|
395
|
-
} else {
|
|
396
|
-
return false;
|
|
397
|
-
}
|
|
398
|
-
} else {
|
|
399
|
-
return false;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
function setNestedProperty(object, property, value) {
|
|
403
|
-
if (object && typeof object == "object") {
|
|
404
|
-
if (typeof property == "string" && property !== "") {
|
|
405
|
-
var split = property.split(".");
|
|
406
|
-
return split.reduce(function (obj, prop, idx) {
|
|
407
|
-
obj[prop] = obj[prop] || ({});
|
|
408
|
-
if (split.length == idx + 1) {
|
|
409
|
-
obj[prop] = value;
|
|
410
|
-
}
|
|
411
|
-
return obj[prop];
|
|
412
|
-
}, object);
|
|
413
|
-
} else if (typeof property == "number") {
|
|
414
|
-
object[property] = value;
|
|
415
|
-
return object[property];
|
|
416
|
-
} else {
|
|
417
|
-
return object;
|
|
418
|
-
}
|
|
419
|
-
} else {
|
|
420
|
-
return object;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
function isInNestedProperty(object, property, objectInPath, options) {
|
|
424
|
-
options = options || ({});
|
|
425
|
-
if (object && typeof object == "object") {
|
|
426
|
-
if (typeof property == "string" && property !== "") {
|
|
427
|
-
var split = property.split("."), isIn = false, pathExists;
|
|
428
|
-
pathExists = !!split.reduce(function (obj, prop) {
|
|
429
|
-
isIn = isIn || obj === objectInPath || !!obj && obj[prop] === objectInPath;
|
|
430
|
-
return obj && obj[prop];
|
|
431
|
-
}, object);
|
|
432
|
-
if (options.validPath) {
|
|
433
|
-
return isIn && pathExists;
|
|
434
|
-
} else {
|
|
435
|
-
return isIn;
|
|
436
|
-
}
|
|
437
|
-
} else {
|
|
438
|
-
return false;
|
|
439
|
-
}
|
|
440
|
-
} else {
|
|
441
|
-
return false;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
var nestedProperty_1 = nestedProperty.set;
|
|
445
|
-
var nestedProperty_2 = nestedProperty.get;
|
|
446
|
-
var interopRequireDefault = createCommonjsModule(function (module) {
|
|
447
|
-
function _interopRequireDefault(obj) {
|
|
448
|
-
return obj && obj.__esModule ? obj : {
|
|
449
|
-
"default": obj
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
module.exports = _interopRequireDefault;
|
|
453
|
-
});
|
|
454
|
-
unwrapExports(interopRequireDefault);
|
|
455
|
-
var setPrototypeOf = createCommonjsModule(function (module) {
|
|
456
|
-
function _setPrototypeOf(o, p) {
|
|
457
|
-
module.exports = _setPrototypeOf = Object.setPrototypeOf || (function _setPrototypeOf(o, p) {
|
|
458
|
-
o.__proto__ = p;
|
|
459
|
-
return o;
|
|
460
|
-
});
|
|
461
|
-
return _setPrototypeOf(o, p);
|
|
462
|
-
}
|
|
463
|
-
module.exports = _setPrototypeOf;
|
|
464
|
-
});
|
|
465
|
-
function _inheritsLoose(subClass, superClass) {
|
|
466
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
467
|
-
subClass.prototype.constructor = subClass;
|
|
468
|
-
setPrototypeOf(subClass, superClass);
|
|
469
|
-
}
|
|
470
|
-
var inheritsLoose = _inheritsLoose;
|
|
471
|
-
var setStatic_1 = createCommonjsModule(function (module, exports) {
|
|
472
|
-
exports.__esModule = true;
|
|
473
|
-
exports.default = void 0;
|
|
474
|
-
var setStatic = function setStatic(key, value) {
|
|
475
|
-
return function (BaseComponent) {
|
|
476
|
-
BaseComponent[key] = value;
|
|
477
|
-
return BaseComponent;
|
|
478
|
-
};
|
|
479
|
-
};
|
|
480
|
-
var _default = setStatic;
|
|
481
|
-
exports.default = _default;
|
|
482
|
-
});
|
|
483
|
-
unwrapExports(setStatic_1);
|
|
484
|
-
var setDisplayName_1 = createCommonjsModule(function (module, exports) {
|
|
485
|
-
exports.__esModule = true;
|
|
486
|
-
exports.default = void 0;
|
|
487
|
-
var _setStatic = interopRequireDefault(setStatic_1);
|
|
488
|
-
var setDisplayName = function setDisplayName(displayName) {
|
|
489
|
-
return (0, _setStatic.default)('displayName', displayName);
|
|
490
|
-
};
|
|
491
|
-
var _default = setDisplayName;
|
|
492
|
-
exports.default = _default;
|
|
493
|
-
});
|
|
494
|
-
unwrapExports(setDisplayName_1);
|
|
495
|
-
var getDisplayName_1 = createCommonjsModule(function (module, exports) {
|
|
496
|
-
exports.__esModule = true;
|
|
497
|
-
exports.default = void 0;
|
|
498
|
-
var getDisplayName = function getDisplayName(Component) {
|
|
499
|
-
if (typeof Component === 'string') {
|
|
500
|
-
return Component;
|
|
501
|
-
}
|
|
502
|
-
if (!Component) {
|
|
503
|
-
return undefined;
|
|
504
|
-
}
|
|
505
|
-
return Component.displayName || Component.name || 'Component';
|
|
506
|
-
};
|
|
507
|
-
var _default = getDisplayName;
|
|
508
|
-
exports.default = _default;
|
|
509
|
-
});
|
|
510
|
-
unwrapExports(getDisplayName_1);
|
|
511
|
-
var wrapDisplayName_1 = createCommonjsModule(function (module, exports) {
|
|
512
|
-
exports.__esModule = true;
|
|
513
|
-
exports.default = void 0;
|
|
514
|
-
var _getDisplayName = interopRequireDefault(getDisplayName_1);
|
|
515
|
-
var wrapDisplayName = function wrapDisplayName(BaseComponent, hocName) {
|
|
516
|
-
return hocName + "(" + (0, _getDisplayName.default)(BaseComponent) + ")";
|
|
517
|
-
};
|
|
518
|
-
var _default = wrapDisplayName;
|
|
519
|
-
exports.default = _default;
|
|
520
|
-
});
|
|
521
|
-
unwrapExports(wrapDisplayName_1);
|
|
522
|
-
const _react = _dll_react;
|
|
523
|
-
var shouldUpdate_1 = createCommonjsModule(function (module, exports) {
|
|
524
|
-
exports.__esModule = true;
|
|
525
|
-
exports.default = void 0;
|
|
526
|
-
var _inheritsLoose2 = interopRequireDefault(inheritsLoose);
|
|
527
|
-
var _setDisplayName = interopRequireDefault(setDisplayName_1);
|
|
528
|
-
var _wrapDisplayName = interopRequireDefault(wrapDisplayName_1);
|
|
529
|
-
var shouldUpdate = function shouldUpdate(test) {
|
|
530
|
-
return function (BaseComponent) {
|
|
531
|
-
var factory = (0, _react.createFactory)(BaseComponent);
|
|
532
|
-
var ShouldUpdate = (function (_Component) {
|
|
533
|
-
(0, _inheritsLoose2.default)(ShouldUpdate, _Component);
|
|
534
|
-
function ShouldUpdate() {
|
|
535
|
-
return _Component.apply(this, arguments) || this;
|
|
536
|
-
}
|
|
537
|
-
var _proto = ShouldUpdate.prototype;
|
|
538
|
-
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
|
539
|
-
return test(this.props, nextProps);
|
|
540
|
-
};
|
|
541
|
-
_proto.render = function render() {
|
|
542
|
-
return factory(this.props);
|
|
543
|
-
};
|
|
544
|
-
return ShouldUpdate;
|
|
545
|
-
})(_react.Component);
|
|
546
|
-
{
|
|
547
|
-
return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'shouldUpdate'))(ShouldUpdate);
|
|
548
|
-
}
|
|
549
|
-
};
|
|
550
|
-
};
|
|
551
|
-
var _default = shouldUpdate;
|
|
552
|
-
exports.default = _default;
|
|
553
|
-
});
|
|
554
|
-
unwrapExports(shouldUpdate_1);
|
|
555
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
556
|
-
function is(x, y) {
|
|
557
|
-
if (x === y) {
|
|
558
|
-
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
559
|
-
} else {
|
|
560
|
-
return x !== x && y !== y;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
function shallowEqual(objA, objB) {
|
|
564
|
-
if (is(objA, objB)) {
|
|
565
|
-
return true;
|
|
566
|
-
}
|
|
567
|
-
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
|
568
|
-
return false;
|
|
569
|
-
}
|
|
570
|
-
var keysA = Object.keys(objA);
|
|
571
|
-
var keysB = Object.keys(objB);
|
|
572
|
-
if (keysA.length !== keysB.length) {
|
|
573
|
-
return false;
|
|
574
|
-
}
|
|
575
|
-
for (var i = 0; i < keysA.length; i++) {
|
|
576
|
-
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
|
577
|
-
return false;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
return true;
|
|
581
|
-
}
|
|
582
|
-
var shallowEqual_1 = shallowEqual;
|
|
583
|
-
var shallowEqual$1 = createCommonjsModule(function (module, exports) {
|
|
584
|
-
exports.__esModule = true;
|
|
585
|
-
exports.default = void 0;
|
|
586
|
-
var _shallowEqual = interopRequireDefault(shallowEqual_1);
|
|
587
|
-
var _default = _shallowEqual.default;
|
|
588
|
-
exports.default = _default;
|
|
589
|
-
});
|
|
590
|
-
unwrapExports(shallowEqual$1);
|
|
591
|
-
var pure_1 = createCommonjsModule(function (module, exports) {
|
|
592
|
-
exports.__esModule = true;
|
|
593
|
-
exports.default = void 0;
|
|
594
|
-
var _shouldUpdate = interopRequireDefault(shouldUpdate_1);
|
|
595
|
-
var _shallowEqual = interopRequireDefault(shallowEqual$1);
|
|
596
|
-
var _setDisplayName = interopRequireDefault(setDisplayName_1);
|
|
597
|
-
var _wrapDisplayName = interopRequireDefault(wrapDisplayName_1);
|
|
598
|
-
var pure = function pure(BaseComponent) {
|
|
599
|
-
var hoc = (0, _shouldUpdate.default)(function (props, nextProps) {
|
|
600
|
-
return !(0, _shallowEqual.default)(props, nextProps);
|
|
601
|
-
});
|
|
602
|
-
{
|
|
603
|
-
return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'pure'))(hoc(BaseComponent));
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
var _default = pure;
|
|
607
|
-
exports.default = _default;
|
|
608
|
-
});
|
|
609
|
-
unwrapExports(pure_1);
|
|
610
|
-
const require$$0 = _dll_react;
|
|
611
|
-
const {SvgIcon: require$$2} = _dll_material_ui__core;
|
|
612
|
-
var createSvgIcon_1 = createCommonjsModule(function (module, exports) {
|
|
613
|
-
Object.defineProperty(exports, "__esModule", {
|
|
614
|
-
value: true
|
|
615
|
-
});
|
|
616
|
-
exports.default = void 0;
|
|
617
|
-
var _react = interopRequireDefault(require$$0);
|
|
618
|
-
var _pure = interopRequireDefault(pure_1);
|
|
619
|
-
var _SvgIcon = interopRequireDefault(require$$2);
|
|
620
|
-
function createSvgIcon(path, displayName) {
|
|
621
|
-
var Icon = function Icon(props) {
|
|
622
|
-
return _react.default.createElement(_SvgIcon.default, props, path);
|
|
623
|
-
};
|
|
624
|
-
Icon.displayName = ("").concat(displayName, "Icon");
|
|
625
|
-
Icon = (0, _pure.default)(Icon);
|
|
626
|
-
Icon.muiName = 'SvgIcon';
|
|
627
|
-
return Icon;
|
|
628
|
-
}
|
|
629
|
-
var _default = createSvgIcon;
|
|
630
|
-
exports.default = _default;
|
|
631
|
-
});
|
|
632
|
-
unwrapExports(createSvgIcon_1);
|
|
633
|
-
const require$$0$1 = _dll_react;
|
|
634
|
-
var DragHandle = createCommonjsModule(function (module, exports) {
|
|
635
|
-
Object.defineProperty(exports, "__esModule", {
|
|
636
|
-
value: true
|
|
637
|
-
});
|
|
638
|
-
exports.default = void 0;
|
|
639
|
-
var _react = interopRequireDefault(require$$0$1);
|
|
640
|
-
var _createSvgIcon = interopRequireDefault(createSvgIcon_1);
|
|
641
|
-
var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("defs", null, _react.default.createElement("path", {
|
|
642
|
-
id: "a",
|
|
643
|
-
d: "M0 0h24v24H0V0z"
|
|
644
|
-
})), _react.default.createElement("path", {
|
|
645
|
-
d: "M20 9H4v2h16V9zM4 15h16v-2H4v2z"
|
|
646
|
-
})), 'DragHandle');
|
|
647
|
-
exports.default = _default;
|
|
648
|
-
});
|
|
649
|
-
var DragHandle$1 = unwrapExports(DragHandle);
|
|
650
|
-
var classnames = createCommonjsModule(function (module) {
|
|
651
|
-
(function () {
|
|
652
|
-
var hasOwn = ({}).hasOwnProperty;
|
|
653
|
-
function classNames() {
|
|
654
|
-
var classes = [];
|
|
655
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
656
|
-
var arg = arguments[i];
|
|
657
|
-
if (!arg) continue;
|
|
658
|
-
var argType = typeof arg;
|
|
659
|
-
if (argType === 'string' || argType === 'number') {
|
|
660
|
-
classes.push(arg);
|
|
661
|
-
} else if (Array.isArray(arg) && arg.length) {
|
|
662
|
-
var inner = classNames.apply(null, arg);
|
|
663
|
-
if (inner) {
|
|
664
|
-
classes.push(inner);
|
|
665
|
-
}
|
|
666
|
-
} else if (argType === 'object') {
|
|
667
|
-
for (var key in arg) {
|
|
668
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
669
|
-
classes.push(key);
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
return classes.join(' ');
|
|
675
|
-
}
|
|
676
|
-
if (module.exports) {
|
|
677
|
-
classNames.default = classNames;
|
|
678
|
-
module.exports = classNames;
|
|
679
|
-
} else {
|
|
680
|
-
window.classNames = classNames;
|
|
681
|
-
}
|
|
682
|
-
})();
|
|
683
|
-
});
|
|
684
|
-
const require$$0$2 = _dll_react;
|
|
685
|
-
var RemoveCircle = createCommonjsModule(function (module, exports) {
|
|
686
|
-
Object.defineProperty(exports, "__esModule", {
|
|
687
|
-
value: true
|
|
688
|
-
});
|
|
689
|
-
exports.default = void 0;
|
|
690
|
-
var _react = interopRequireDefault(require$$0$2);
|
|
691
|
-
var _createSvgIcon = interopRequireDefault(createSvgIcon_1);
|
|
692
|
-
var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
|
|
693
|
-
fill: "none",
|
|
694
|
-
d: "M0 0h24v24H0z"
|
|
695
|
-
}), _react.default.createElement("path", {
|
|
696
|
-
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11H7v-2h10v2z"
|
|
697
|
-
})), 'RemoveCircle');
|
|
698
|
-
exports.default = _default;
|
|
699
|
-
});
|
|
700
|
-
var RemoveCircle$1 = unwrapExports(RemoveCircle);
|
|
701
|
-
const EditableHtml = _dll_pie_lib__editable_html;
|
|
702
|
-
const {CardActions: CardActions} = _dll_material_ui__core;
|
|
703
|
-
const {IconButton: IconButton} = _dll_material_ui__core;
|
|
704
|
-
const {DragSource: DragSource} = _dll_react_dnd;
|
|
705
|
-
const {DropTarget: DropTarget} = _dll_react_dnd;
|
|
706
|
-
const PropTypes = _dll_prop_types;
|
|
707
|
-
const React = _dll_react;
|
|
708
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
709
|
-
const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/packages/placement-ordering/configure/src/choice-tile.jsx";
|
|
710
|
-
const log = browser('@pie-element:placement-ordering:configure:choice-tile');
|
|
711
|
-
class ChoiceTile extends React.Component {
|
|
712
|
-
constructor(...args) {
|
|
713
|
-
super(...args);
|
|
714
|
-
ChoiceTile.prototype.__init.call(this);
|
|
715
|
-
}
|
|
716
|
-
static __initStatic() {
|
|
717
|
-
this.propTypes = {
|
|
718
|
-
connectDragSource: PropTypes.func.isRequired,
|
|
719
|
-
connectDropTarget: PropTypes.func.isRequired,
|
|
720
|
-
isDragging: PropTypes.bool.isRequired,
|
|
721
|
-
id: PropTypes.any,
|
|
722
|
-
label: PropTypes.string,
|
|
723
|
-
isOver: PropTypes.bool,
|
|
724
|
-
classes: PropTypes.object.isRequired,
|
|
725
|
-
type: PropTypes.string,
|
|
726
|
-
empty: PropTypes.bool,
|
|
727
|
-
disabled: PropTypes.bool,
|
|
728
|
-
outcome: PropTypes.object,
|
|
729
|
-
index: PropTypes.number,
|
|
730
|
-
imageSupport: PropTypes.shape({
|
|
731
|
-
add: PropTypes.func.isRequired,
|
|
732
|
-
delete: PropTypes.func.isRequired
|
|
733
|
-
}),
|
|
734
|
-
choice: PropTypes.object,
|
|
735
|
-
onChoiceChange: PropTypes.func.isRequired,
|
|
736
|
-
onDelete: PropTypes.func.isRequired,
|
|
737
|
-
disableImages: PropTypes.bool
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
__init() {
|
|
741
|
-
this.onLabelChange = label => {
|
|
742
|
-
const {choice, onChoiceChange} = this.props;
|
|
743
|
-
choice.label = label;
|
|
744
|
-
onChoiceChange(choice);
|
|
745
|
-
};
|
|
746
|
-
}
|
|
747
|
-
render() {
|
|
748
|
-
const {choice: {label, editable}, isDragging, connectDragSource, connectDropTarget, classes, onDelete, imageSupport, disableImages} = this.props;
|
|
749
|
-
const dragSourceOpts = {};
|
|
750
|
-
const opacity = isDragging ? 0 : 1;
|
|
751
|
-
const markup = React.createElement('div', {
|
|
752
|
-
className: classes.choiceTile,
|
|
753
|
-
style: {
|
|
754
|
-
opacity: opacity,
|
|
755
|
-
width: '100%'
|
|
756
|
-
},
|
|
757
|
-
__self: this,
|
|
758
|
-
__source: {
|
|
759
|
-
fileName: _jsxFileName,
|
|
760
|
-
lineNumber: 66
|
|
761
|
-
}
|
|
762
|
-
}, React.createElement(CardActions, {
|
|
763
|
-
__self: this,
|
|
764
|
-
__source: {
|
|
765
|
-
fileName: _jsxFileName,
|
|
766
|
-
lineNumber: 67
|
|
767
|
-
}
|
|
768
|
-
}, React.createElement('span', {
|
|
769
|
-
className: classnames(classes.dragHandle),
|
|
770
|
-
__self: this,
|
|
771
|
-
__source: {
|
|
772
|
-
fileName: _jsxFileName,
|
|
773
|
-
lineNumber: 68
|
|
774
|
-
}
|
|
775
|
-
}, React.createElement(DragHandle$1, {
|
|
776
|
-
className: classes.actions,
|
|
777
|
-
__self: this,
|
|
778
|
-
__source: {
|
|
779
|
-
fileName: _jsxFileName,
|
|
780
|
-
lineNumber: 69
|
|
781
|
-
}
|
|
782
|
-
}))), React.createElement(EditableHtml, {
|
|
783
|
-
disabled: !editable,
|
|
784
|
-
className: classnames(classes.prompt, !editable && classes.targetPrompt),
|
|
785
|
-
placeholder: "Enter a choice",
|
|
786
|
-
markup: label,
|
|
787
|
-
imageSupport: imageSupport || undefined,
|
|
788
|
-
onChange: this.onLabelChange,
|
|
789
|
-
pluginProps: {
|
|
790
|
-
image: {
|
|
791
|
-
disabled: disableImages
|
|
792
|
-
}
|
|
793
|
-
},
|
|
794
|
-
__self: this,
|
|
795
|
-
__source: {
|
|
796
|
-
fileName: _jsxFileName,
|
|
797
|
-
lineNumber: 72
|
|
798
|
-
}
|
|
799
|
-
}), editable && React.createElement('div', {
|
|
800
|
-
className: classes.controls,
|
|
801
|
-
__self: this,
|
|
802
|
-
__source: {
|
|
803
|
-
fileName: _jsxFileName,
|
|
804
|
-
lineNumber: 86
|
|
805
|
-
}
|
|
806
|
-
}, React.createElement(IconButton, {
|
|
807
|
-
color: "default",
|
|
808
|
-
onClick: onDelete,
|
|
809
|
-
__self: this,
|
|
810
|
-
__source: {
|
|
811
|
-
fileName: _jsxFileName,
|
|
812
|
-
lineNumber: 87
|
|
813
|
-
}
|
|
814
|
-
}, React.createElement(RemoveCircle$1, {
|
|
815
|
-
classes: {
|
|
816
|
-
root: classes.removeCircle
|
|
817
|
-
},
|
|
818
|
-
__self: this,
|
|
819
|
-
__source: {
|
|
820
|
-
fileName: _jsxFileName,
|
|
821
|
-
lineNumber: 88
|
|
822
|
-
}
|
|
823
|
-
}))));
|
|
824
|
-
return connectDragSource(connectDropTarget(React.createElement('div', {
|
|
825
|
-
__self: this,
|
|
826
|
-
__source: {
|
|
827
|
-
fileName: _jsxFileName,
|
|
828
|
-
lineNumber: 102
|
|
829
|
-
}
|
|
830
|
-
}, markup)), dragSourceOpts);
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
ChoiceTile.__initStatic();
|
|
834
|
-
const Styled = withStyles(theme => ({
|
|
835
|
-
removeCircle: {
|
|
836
|
-
fill: theme.palette.error[500]
|
|
837
|
-
},
|
|
838
|
-
choiceTile: {
|
|
839
|
-
cursor: 'move',
|
|
840
|
-
backgroundColor: 'white',
|
|
841
|
-
marginTop: '5px',
|
|
842
|
-
marginBottom: '5px',
|
|
843
|
-
display: 'flex',
|
|
844
|
-
alignItems: 'center'
|
|
845
|
-
},
|
|
846
|
-
controls: {
|
|
847
|
-
display: 'flex',
|
|
848
|
-
justifyContent: 'flex-end'
|
|
849
|
-
},
|
|
850
|
-
prompt: {
|
|
851
|
-
width: '80%',
|
|
852
|
-
border: 'none'
|
|
853
|
-
},
|
|
854
|
-
targetPrompt: {
|
|
855
|
-
backgroundColor: '#D7D7D7'
|
|
856
|
-
},
|
|
857
|
-
actions: {
|
|
858
|
-
color: '#B1B1B1'
|
|
859
|
-
}
|
|
860
|
-
}))(ChoiceTile);
|
|
861
|
-
const NAME = 'choice-config';
|
|
862
|
-
const choiceSource = {
|
|
863
|
-
beginDrag(props) {
|
|
864
|
-
return {
|
|
865
|
-
id: props.choice.id,
|
|
866
|
-
index: props.index,
|
|
867
|
-
type: props.choice.type,
|
|
868
|
-
instanceId: props.choice.instanceId
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
};
|
|
872
|
-
const StyledSource = DragSource(NAME, choiceSource, (connect, monitor) => ({
|
|
873
|
-
connectDragSource: connect.dragSource(),
|
|
874
|
-
isDragging: monitor.isDragging()
|
|
875
|
-
}))(Styled);
|
|
876
|
-
const choiceTarget = {
|
|
877
|
-
hover() {
|
|
878
|
-
log('[hover]');
|
|
879
|
-
},
|
|
880
|
-
drop(props, monitor) {
|
|
881
|
-
const item = monitor.getItem();
|
|
882
|
-
log('[drop] item: ', item, 'didDrop?', monitor.didDrop());
|
|
883
|
-
props.onDropChoice(item, props.index);
|
|
884
|
-
}
|
|
885
|
-
};
|
|
886
|
-
const StyledSourceAndTarget = DropTarget(NAME, choiceTarget, (connect, monitor) => ({
|
|
887
|
-
connectDropTarget: connect.dropTarget(),
|
|
888
|
-
isOver: monitor.isOver()
|
|
889
|
-
}))(StyledSource);
|
|
890
|
-
const PropTypes$1 = _dll_prop_types;
|
|
891
|
-
const React$1 = _dll_react;
|
|
892
|
-
const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
|
|
893
|
-
const {isEmpty: isEmpty} = _dll_lodash;
|
|
894
|
-
const {cloneDeep: cloneDeep} = _dll_lodash;
|
|
895
|
-
const {uniqueId: uniqueId} = _dll_lodash;
|
|
896
|
-
const {Button: Button} = _dll_material_ui__core;
|
|
897
|
-
const _jsxFileName$1 = "/home/ede/dev/github/pie-framework/pie-elements/packages/placement-ordering/configure/src/choice-editor.jsx";
|
|
898
|
-
function findFreeChoiceSlot(choices) {
|
|
899
|
-
let slot = 1;
|
|
900
|
-
const ids = choices.map(c => c.id);
|
|
901
|
-
while (ids.includes(`c${slot}`)) {
|
|
902
|
-
slot++;
|
|
903
|
-
}
|
|
904
|
-
return slot;
|
|
905
|
-
}
|
|
906
|
-
const log$1 = browser('@pie-element:placement-ordering:configure:choice-editor');
|
|
907
|
-
function updateResponse(response, from, to) {
|
|
908
|
-
const update = cloneDeep(response);
|
|
909
|
-
const {type: fromType} = from;
|
|
910
|
-
const {type: toType, index: placeAtIndex} = to;
|
|
911
|
-
if (fromType === 'choice' && toType === 'target' || fromType === 'target' && toType === 'target') {
|
|
912
|
-
const optionToSwitch = update[placeAtIndex];
|
|
913
|
-
const currentPositionOfOption = update.findIndex(up => up.id === from.id);
|
|
914
|
-
const option = update.find(up => up.id === from.id);
|
|
915
|
-
update[placeAtIndex] = option;
|
|
916
|
-
update[currentPositionOfOption] = optionToSwitch;
|
|
917
|
-
return update;
|
|
918
|
-
}
|
|
919
|
-
return response;
|
|
920
|
-
}
|
|
921
|
-
function buildTiles(choices, response, instanceId) {
|
|
922
|
-
const targets = response.map((r, index) => {
|
|
923
|
-
const respId = r && r.id;
|
|
924
|
-
const choice = choices.find(c => respId !== undefined && respId !== null && c.id === respId);
|
|
925
|
-
return {
|
|
926
|
-
type: 'target',
|
|
927
|
-
instanceId,
|
|
928
|
-
...choice,
|
|
929
|
-
draggable: true,
|
|
930
|
-
index,
|
|
931
|
-
editable: false
|
|
932
|
-
};
|
|
933
|
-
});
|
|
934
|
-
const processedChoices = choices.map(m => {
|
|
935
|
-
return Object.assign({}, m, {
|
|
936
|
-
type: 'choice',
|
|
937
|
-
droppable: false,
|
|
938
|
-
draggable: true,
|
|
939
|
-
instanceId,
|
|
940
|
-
editable: true
|
|
941
|
-
});
|
|
942
|
-
});
|
|
943
|
-
return processedChoices.concat(targets);
|
|
944
|
-
}
|
|
945
|
-
class ChoiceEditor extends React$1.Component {
|
|
946
|
-
static __initStatic() {
|
|
947
|
-
this.propTypes = {
|
|
948
|
-
classes: PropTypes$1.object.isRequired,
|
|
949
|
-
correctResponse: PropTypes$1.array.isRequired,
|
|
950
|
-
choices: PropTypes$1.array.isRequired,
|
|
951
|
-
onChange: PropTypes$1.func.isRequired,
|
|
952
|
-
imageSupport: PropTypes$1.shape({
|
|
953
|
-
add: PropTypes$1.func.isRequired,
|
|
954
|
-
delete: PropTypes$1.func.isRequired
|
|
955
|
-
}),
|
|
956
|
-
disableImages: PropTypes$1.bool
|
|
957
|
-
};
|
|
958
|
-
}
|
|
959
|
-
constructor(props) {
|
|
960
|
-
super(props);
|
|
961
|
-
this.instanceId = uniqueId();
|
|
962
|
-
this.onChoiceChange = choice => {
|
|
963
|
-
const {choices, onChange, correctResponse} = this.props;
|
|
964
|
-
const index = choices.findIndex(c => c.id === choice.id);
|
|
965
|
-
choices.splice(index, 1, {
|
|
966
|
-
...choices[index],
|
|
967
|
-
label: choice.label
|
|
968
|
-
});
|
|
969
|
-
onChange(choices, correctResponse);
|
|
970
|
-
};
|
|
971
|
-
this.onDelete = choice => {
|
|
972
|
-
const {choices, onChange, correctResponse} = this.props;
|
|
973
|
-
const updatedChoices = choices.filter(c => c.id !== choice.id);
|
|
974
|
-
const updatedCorrectResponse = correctResponse.filter(v => v.id !== choice.id);
|
|
975
|
-
onChange(updatedChoices, updatedCorrectResponse);
|
|
976
|
-
};
|
|
977
|
-
this.addChoice = () => {
|
|
978
|
-
const {choices, correctResponse, onChange} = this.props;
|
|
979
|
-
const freeId = findFreeChoiceSlot(choices);
|
|
980
|
-
const id = `c${freeId}`;
|
|
981
|
-
const newChoice = {
|
|
982
|
-
id,
|
|
983
|
-
label: ''
|
|
984
|
-
};
|
|
985
|
-
const newCorrectResponse = {
|
|
986
|
-
id,
|
|
987
|
-
weight: 0
|
|
988
|
-
};
|
|
989
|
-
const updatedChoices = choices.concat([newChoice]);
|
|
990
|
-
const updatedCorrectResponse = correctResponse.concat([newCorrectResponse]);
|
|
991
|
-
onChange(updatedChoices, updatedCorrectResponse);
|
|
992
|
-
};
|
|
993
|
-
this.onDropChoice = (ordering, target, source) => {
|
|
994
|
-
const {onChange, choices} = this.props;
|
|
995
|
-
const from = ordering.tiles.find(t => t.id === source.id && t.type === source.type);
|
|
996
|
-
const to = target;
|
|
997
|
-
log$1('[onDropChoice] ', from, to);
|
|
998
|
-
const response = updateResponse(ordering.response, from, to);
|
|
999
|
-
onChange(choices, response);
|
|
1000
|
-
};
|
|
1001
|
-
}
|
|
1002
|
-
render() {
|
|
1003
|
-
const {classes, correctResponse, choices, imageSupport, disableImages} = this.props;
|
|
1004
|
-
const ordering = {
|
|
1005
|
-
choices,
|
|
1006
|
-
response: !correctResponse || isEmpty(correctResponse) ? new Array(choices.length) : correctResponse,
|
|
1007
|
-
tiles: buildTiles(choices, correctResponse, this.instanceId)
|
|
1008
|
-
};
|
|
1009
|
-
const style = {
|
|
1010
|
-
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
1011
|
-
gridTemplateRows: `repeat(${choices.length}, 1fr)`
|
|
1012
|
-
};
|
|
1013
|
-
return React$1.createElement('div', {
|
|
1014
|
-
className: classes.choiceEditor,
|
|
1015
|
-
__self: this,
|
|
1016
|
-
__source: {
|
|
1017
|
-
fileName: _jsxFileName$1,
|
|
1018
|
-
lineNumber: 157
|
|
1019
|
-
}
|
|
1020
|
-
}, React$1.createElement('div', {
|
|
1021
|
-
className: classes.vtiler,
|
|
1022
|
-
style: style,
|
|
1023
|
-
__self: this,
|
|
1024
|
-
__source: {
|
|
1025
|
-
fileName: _jsxFileName$1,
|
|
1026
|
-
lineNumber: 158
|
|
1027
|
-
}
|
|
1028
|
-
}, ordering.tiles.map((c, index) => React$1.createElement(StyledSourceAndTarget, {
|
|
1029
|
-
choice: c,
|
|
1030
|
-
index: index,
|
|
1031
|
-
key: index,
|
|
1032
|
-
imageSupport: imageSupport,
|
|
1033
|
-
onDelete: this.onDelete.bind(this, c),
|
|
1034
|
-
onChoiceChange: this.onChoiceChange,
|
|
1035
|
-
onDropChoice: (source, index) => this.onDropChoice(ordering, c, source, index),
|
|
1036
|
-
disableImages: disableImages,
|
|
1037
|
-
__self: this,
|
|
1038
|
-
__source: {
|
|
1039
|
-
fileName: _jsxFileName$1,
|
|
1040
|
-
lineNumber: 161
|
|
1041
|
-
}
|
|
1042
|
-
}))), React$1.createElement('div', {
|
|
1043
|
-
className: classes.controls,
|
|
1044
|
-
__self: this,
|
|
1045
|
-
__source: {
|
|
1046
|
-
fileName: _jsxFileName$1,
|
|
1047
|
-
lineNumber: 173
|
|
1048
|
-
}
|
|
1049
|
-
}, React$1.createElement(Button, {
|
|
1050
|
-
onClick: this.addChoice,
|
|
1051
|
-
size: "small",
|
|
1052
|
-
variant: "contained",
|
|
1053
|
-
color: "default",
|
|
1054
|
-
classes: {
|
|
1055
|
-
root: classes.addButtonRoot,
|
|
1056
|
-
label: classes.addButtonLabel
|
|
1057
|
-
},
|
|
1058
|
-
__self: this,
|
|
1059
|
-
__source: {
|
|
1060
|
-
fileName: _jsxFileName$1,
|
|
1061
|
-
lineNumber: 174
|
|
1062
|
-
}
|
|
1063
|
-
}, "ADD CHOICE")));
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
ChoiceEditor.__initStatic();
|
|
1067
|
-
const styles = theme => ({
|
|
1068
|
-
allToggle: {},
|
|
1069
|
-
choiceEditor: {
|
|
1070
|
-
marginTop: '10px'
|
|
1071
|
-
},
|
|
1072
|
-
controls: {
|
|
1073
|
-
display: 'flex',
|
|
1074
|
-
alignItems: 'center',
|
|
1075
|
-
justifyContent: 'space-between'
|
|
1076
|
-
},
|
|
1077
|
-
root: {
|
|
1078
|
-
width: '30px',
|
|
1079
|
-
height: '30px',
|
|
1080
|
-
fill: theme.palette.primary[500]
|
|
1081
|
-
},
|
|
1082
|
-
addButtonRoot: {
|
|
1083
|
-
marginTop: '24px',
|
|
1084
|
-
paddingHorizontal: '12px'
|
|
1085
|
-
},
|
|
1086
|
-
addButtonLabel: {
|
|
1087
|
-
transition: 'opacity 200ms linear',
|
|
1088
|
-
'&:hover': {
|
|
1089
|
-
opacity: 0.3
|
|
1090
|
-
}
|
|
1091
|
-
},
|
|
1092
|
-
vtiler: {
|
|
1093
|
-
gridAutoFlow: 'column',
|
|
1094
|
-
display: 'grid',
|
|
1095
|
-
gridGap: '10px'
|
|
1096
|
-
}
|
|
1097
|
-
});
|
|
1098
|
-
var ChoiceEditor$1 = withStyles$1(styles)(ChoiceEditor);
|
|
1099
|
-
const {FeedbackConfig: FeedbackConfig} = _dll_pie_lib__config_ui;
|
|
1100
|
-
const {FormSection: FormSection} = _dll_pie_lib__config_ui;
|
|
1101
|
-
const {InputContainer: InputContainer} = _dll_pie_lib__config_ui;
|
|
1102
|
-
const {settings: settings} = _dll_pie_lib__config_ui;
|
|
1103
|
-
const {layout: layout} = _dll_pie_lib__config_ui;
|
|
1104
|
-
const EditableHtml$1 = _dll_pie_lib__editable_html;
|
|
1105
|
-
const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
|
|
1106
|
-
const {withDragContext: withDragContext} = _dll_pie_lib__drag;
|
|
1107
|
-
const {cloneDeep: cloneDeep$1} = _dll_lodash;
|
|
1108
|
-
const PropTypes$2 = _dll_prop_types;
|
|
1109
|
-
const React$2 = _dll_react;
|
|
1110
|
-
const _jsxFileName$2 = "/home/ede/dev/github/pie-framework/pie-elements/packages/placement-ordering/configure/src/design.jsx";
|
|
1111
|
-
const log$2 = browser('@pie-element:placement-ordering:design');
|
|
1112
|
-
const {Panel, toggle, radio} = settings;
|
|
1113
|
-
class Design extends React$2.Component {
|
|
1114
|
-
constructor(props) {
|
|
1115
|
-
super(props);
|
|
1116
|
-
this.applyUpdate = modelFn => {
|
|
1117
|
-
const {model, onModelChanged} = this.props;
|
|
1118
|
-
const update = modelFn(cloneDeep$1(model));
|
|
1119
|
-
onModelChanged(update);
|
|
1120
|
-
};
|
|
1121
|
-
this.changeHandler = (modelPath, valuePath) => {
|
|
1122
|
-
return value => {
|
|
1123
|
-
log$2('[changeHandler] value: ', value);
|
|
1124
|
-
const v = valuePath ? nestedProperty_2(value, valuePath) : value;
|
|
1125
|
-
this.applyUpdate(model => {
|
|
1126
|
-
nestedProperty_1(model, modelPath, v);
|
|
1127
|
-
return model;
|
|
1128
|
-
});
|
|
1129
|
-
};
|
|
1130
|
-
};
|
|
1131
|
-
this.onPromptChange = this.changeHandler('prompt');
|
|
1132
|
-
this.onTeacherInstructionsChange = this.changeHandler('teacherInstructions');
|
|
1133
|
-
this.onRationaleChange = this.changeHandler('rationale');
|
|
1134
|
-
this.onChoiceAreaLabelChange = this.changeHandler('choiceLabel', 'target.value');
|
|
1135
|
-
this.onAnswerAreaLabelChange = this.changeHandler('targetLabel', 'target.value');
|
|
1136
|
-
this.onFeedbackChange = this.changeHandler('feedback');
|
|
1137
|
-
this.onChoiceEditorChange = (choices, correctResponse) => {
|
|
1138
|
-
const {model, onModelChanged} = this.props;
|
|
1139
|
-
const update = cloneDeep$1(model);
|
|
1140
|
-
update.choices = choices;
|
|
1141
|
-
update.correctResponse = correctResponse;
|
|
1142
|
-
onModelChanged(update);
|
|
1143
|
-
};
|
|
1144
|
-
}
|
|
1145
|
-
render() {
|
|
1146
|
-
const {model, classes, imageSupport, onModelChanged, configuration, onConfigurationChanged} = this.props;
|
|
1147
|
-
const {choiceLabel = {}, choices = {}, feedback = {}, targetLabel = {}, prompt = {}, placementArea = {}, numberedGuides = {}, enableImages = {}, orientation = {}, removeTilesAfterPlacing = {}, partialScoring = {}, lockChoiceOrder = {}, teacherInstructions = {}, studentInstructions = {}, rationale = {}, scoringType = {}} = configuration || ({});
|
|
1148
|
-
const {teacherInstructionsEnabled, promptEnabled, rationaleEnabled, feedbackEnabled} = model || ({});
|
|
1149
|
-
return React$2.createElement(layout.ConfigLayout, {
|
|
1150
|
-
settings: React$2.createElement(Panel, {
|
|
1151
|
-
model: model,
|
|
1152
|
-
configuration: configuration,
|
|
1153
|
-
onChangeModel: model => onModelChanged(model),
|
|
1154
|
-
onChangeConfiguration: configuration => onConfigurationChanged(configuration, true),
|
|
1155
|
-
groups: {
|
|
1156
|
-
Settings: {
|
|
1157
|
-
'choiceLabel.enabled': choiceLabel.settings && toggle(choiceLabel.label, true),
|
|
1158
|
-
placementArea: placementArea.settings && toggle(placementArea.label),
|
|
1159
|
-
numberedGuides: numberedGuides.settings && model.placementArea && toggle(numberedGuides.label),
|
|
1160
|
-
enableImages: enableImages.settings && toggle(enableImages.label),
|
|
1161
|
-
orientation: orientation.settings && radio(orientation.label, ['vertical', 'horizontal']),
|
|
1162
|
-
removeTilesAfterPlacing: removeTilesAfterPlacing.settings && toggle(removeTilesAfterPlacing.label),
|
|
1163
|
-
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
1164
|
-
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
1165
|
-
feedbackEnabled: feedback.settings && toggle(feedback.label)
|
|
1166
|
-
},
|
|
1167
|
-
Properties: {
|
|
1168
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
1169
|
-
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
1170
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
1171
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
1172
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
|
|
1173
|
-
}
|
|
1174
|
-
},
|
|
1175
|
-
__self: this,
|
|
1176
|
-
__source: {
|
|
1177
|
-
fileName: _jsxFileName$2,
|
|
1178
|
-
lineNumber: 107
|
|
1179
|
-
}
|
|
1180
|
-
}),
|
|
1181
|
-
__self: this,
|
|
1182
|
-
__source: {
|
|
1183
|
-
fileName: _jsxFileName$2,
|
|
1184
|
-
lineNumber: 105
|
|
1185
|
-
}
|
|
1186
|
-
}, teacherInstructionsEnabled && React$2.createElement(InputContainer, {
|
|
1187
|
-
label: teacherInstructions.label,
|
|
1188
|
-
className: classes.promptHolder,
|
|
1189
|
-
__self: this,
|
|
1190
|
-
__source: {
|
|
1191
|
-
fileName: _jsxFileName$2,
|
|
1192
|
-
lineNumber: 157
|
|
1193
|
-
}
|
|
1194
|
-
}, React$2.createElement(EditableHtml$1, {
|
|
1195
|
-
className: classes.prompt,
|
|
1196
|
-
markup: model.teacherInstructions || '',
|
|
1197
|
-
onChange: this.onTeacherInstructionsChange,
|
|
1198
|
-
imageSupport: imageSupport,
|
|
1199
|
-
nonEmpty: false,
|
|
1200
|
-
__self: this,
|
|
1201
|
-
__source: {
|
|
1202
|
-
fileName: _jsxFileName$2,
|
|
1203
|
-
lineNumber: 161
|
|
1204
|
-
}
|
|
1205
|
-
})), promptEnabled && React$2.createElement(FormSection, {
|
|
1206
|
-
label: "Ordering",
|
|
1207
|
-
__self: this,
|
|
1208
|
-
__source: {
|
|
1209
|
-
fileName: _jsxFileName$2,
|
|
1210
|
-
lineNumber: 172
|
|
1211
|
-
}
|
|
1212
|
-
}, React$2.createElement(InputContainer, {
|
|
1213
|
-
label: prompt && prompt.label && prompt.label.toUpperCase(),
|
|
1214
|
-
className: classes.promptHolder,
|
|
1215
|
-
__self: this,
|
|
1216
|
-
__source: {
|
|
1217
|
-
fileName: _jsxFileName$2,
|
|
1218
|
-
lineNumber: 173
|
|
1219
|
-
}
|
|
1220
|
-
}, React$2.createElement(EditableHtml$1, {
|
|
1221
|
-
className: classes.prompt,
|
|
1222
|
-
markup: model.prompt,
|
|
1223
|
-
onChange: this.onPromptChange,
|
|
1224
|
-
imageSupport: imageSupport,
|
|
1225
|
-
__self: this,
|
|
1226
|
-
__source: {
|
|
1227
|
-
fileName: _jsxFileName$2,
|
|
1228
|
-
lineNumber: 177
|
|
1229
|
-
}
|
|
1230
|
-
})), rationaleEnabled && React$2.createElement(InputContainer, {
|
|
1231
|
-
label: rationale.label,
|
|
1232
|
-
className: classes.promptHolder,
|
|
1233
|
-
__self: this,
|
|
1234
|
-
__source: {
|
|
1235
|
-
fileName: _jsxFileName$2,
|
|
1236
|
-
lineNumber: 185
|
|
1237
|
-
}
|
|
1238
|
-
}, React$2.createElement(EditableHtml$1, {
|
|
1239
|
-
className: classes.prompt,
|
|
1240
|
-
markup: model.rationale || '',
|
|
1241
|
-
onChange: this.onRationaleChange,
|
|
1242
|
-
imageSupport: imageSupport,
|
|
1243
|
-
__self: this,
|
|
1244
|
-
__source: {
|
|
1245
|
-
fileName: _jsxFileName$2,
|
|
1246
|
-
lineNumber: 189
|
|
1247
|
-
}
|
|
1248
|
-
}))), React$2.createElement(FormSection, {
|
|
1249
|
-
label: "Define Choices",
|
|
1250
|
-
__self: this,
|
|
1251
|
-
__source: {
|
|
1252
|
-
fileName: _jsxFileName$2,
|
|
1253
|
-
lineNumber: 200
|
|
1254
|
-
}
|
|
1255
|
-
}, React$2.createElement('div', {
|
|
1256
|
-
className: classes.row,
|
|
1257
|
-
__self: this,
|
|
1258
|
-
__source: {
|
|
1259
|
-
fileName: _jsxFileName$2,
|
|
1260
|
-
lineNumber: 201
|
|
1261
|
-
}
|
|
1262
|
-
}, choiceLabel.enabled && React$2.createElement(InputContainer, {
|
|
1263
|
-
label: choiceLabel && choiceLabel.label && choiceLabel.label.toUpperCase(),
|
|
1264
|
-
className: classes.promptHolder,
|
|
1265
|
-
__self: this,
|
|
1266
|
-
__source: {
|
|
1267
|
-
fileName: _jsxFileName$2,
|
|
1268
|
-
lineNumber: 203
|
|
1269
|
-
}
|
|
1270
|
-
}, React$2.createElement(EditableHtml$1, {
|
|
1271
|
-
className: classes.prompt,
|
|
1272
|
-
markup: model.choiceLabel,
|
|
1273
|
-
onChange: this.onChoiceAreaLabelChange,
|
|
1274
|
-
__self: this,
|
|
1275
|
-
__source: {
|
|
1276
|
-
fileName: _jsxFileName$2,
|
|
1277
|
-
lineNumber: 211
|
|
1278
|
-
}
|
|
1279
|
-
})), targetLabel.settings && model.placementArea && React$2.createElement(InputContainer, {
|
|
1280
|
-
label: targetLabel && targetLabel.label && targetLabel.label.toUpperCase(),
|
|
1281
|
-
className: classes.promptHolder,
|
|
1282
|
-
__self: this,
|
|
1283
|
-
__source: {
|
|
1284
|
-
fileName: _jsxFileName$2,
|
|
1285
|
-
lineNumber: 220
|
|
1286
|
-
}
|
|
1287
|
-
}, React$2.createElement(EditableHtml$1, {
|
|
1288
|
-
className: classes.prompt,
|
|
1289
|
-
markup: model.targetLabel,
|
|
1290
|
-
onChange: this.onAnswerAreaLabelChange,
|
|
1291
|
-
__self: this,
|
|
1292
|
-
__source: {
|
|
1293
|
-
fileName: _jsxFileName$2,
|
|
1294
|
-
lineNumber: 228
|
|
1295
|
-
}
|
|
1296
|
-
}))), choices.settings && React$2.createElement(InputContainer, {
|
|
1297
|
-
label: choices && choices.label && choices.label.toUpperCase(),
|
|
1298
|
-
className: classes.promptHolder,
|
|
1299
|
-
__self: this,
|
|
1300
|
-
__source: {
|
|
1301
|
-
fileName: _jsxFileName$2,
|
|
1302
|
-
lineNumber: 238
|
|
1303
|
-
}
|
|
1304
|
-
}, React$2.createElement(ChoiceEditor$1, {
|
|
1305
|
-
correctResponse: model.correctResponse,
|
|
1306
|
-
choices: model.choices,
|
|
1307
|
-
onChange: this.onChoiceEditorChange,
|
|
1308
|
-
imageSupport: imageSupport,
|
|
1309
|
-
disableImages: !model.enableImages,
|
|
1310
|
-
__self: this,
|
|
1311
|
-
__source: {
|
|
1312
|
-
fileName: _jsxFileName$2,
|
|
1313
|
-
lineNumber: 242
|
|
1314
|
-
}
|
|
1315
|
-
}))), feedbackEnabled && React$2.createElement(FeedbackConfig, {
|
|
1316
|
-
feedback: model.feedback,
|
|
1317
|
-
onChange: this.onFeedbackChange,
|
|
1318
|
-
imageSupport: imageSupport,
|
|
1319
|
-
__self: this,
|
|
1320
|
-
__source: {
|
|
1321
|
-
fileName: _jsxFileName$2,
|
|
1322
|
-
lineNumber: 254
|
|
1323
|
-
}
|
|
1324
|
-
}));
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
Design.defaultProps = {
|
|
1328
|
-
onModelChanged: () => {},
|
|
1329
|
-
onConfigurationChanged: () => {}
|
|
1330
|
-
};
|
|
1331
|
-
Design.propTypes = {
|
|
1332
|
-
model: PropTypes$2.object.isRequired,
|
|
1333
|
-
configuration: PropTypes$2.object.isRequired,
|
|
1334
|
-
onModelChanged: PropTypes$2.func,
|
|
1335
|
-
onConfigurationChanged: PropTypes$2.func,
|
|
1336
|
-
classes: PropTypes$2.object.isRequired,
|
|
1337
|
-
imageSupport: PropTypes$2.object
|
|
1338
|
-
};
|
|
1339
|
-
var Main = withDragContext(withStyles$2(theme => ({
|
|
1340
|
-
promptHolder: {
|
|
1341
|
-
width: '100%',
|
|
1342
|
-
paddingTop: '12px',
|
|
1343
|
-
marginTop: '24px'
|
|
1344
|
-
},
|
|
1345
|
-
prompt: {
|
|
1346
|
-
paddingTop: theme.spacing.unit * 2,
|
|
1347
|
-
paddingBottom: theme.spacing.unit
|
|
1348
|
-
},
|
|
1349
|
-
row: {
|
|
1350
|
-
display: 'grid',
|
|
1351
|
-
gridAutoFlow: 'column',
|
|
1352
|
-
gridAutoColumns: '1fr',
|
|
1353
|
-
gridGap: '8px'
|
|
1354
|
-
}
|
|
1355
|
-
}))(Design));
|
|
1356
|
-
var defaultValues = {
|
|
1357
|
-
model: {
|
|
1358
|
-
choiceLabel: 'Choice Label goes here',
|
|
1359
|
-
choices: [],
|
|
1360
|
-
correctResponse: [],
|
|
1361
|
-
enableImages: false,
|
|
1362
|
-
prompt: 'Item Stem goes here',
|
|
1363
|
-
lockChoiceOrder: false,
|
|
1364
|
-
numberedGuides: false,
|
|
1365
|
-
orientation: 'vertical',
|
|
1366
|
-
partialScoring: true,
|
|
1367
|
-
placementArea: false,
|
|
1368
|
-
removeTilesAfterPlacing: true,
|
|
1369
|
-
scoringType: 'auto',
|
|
1370
|
-
targetLabel: 'Target Label goes here',
|
|
1371
|
-
rationaleEnabled: true,
|
|
1372
|
-
feedbackEnabled: true,
|
|
1373
|
-
promptEnabled: true,
|
|
1374
|
-
teacherInstructionsEnabled: true,
|
|
1375
|
-
studentInstructionsEnabled: true
|
|
1376
|
-
},
|
|
1377
|
-
configuration: {
|
|
1378
|
-
choiceLabel: {
|
|
1379
|
-
settings: true,
|
|
1380
|
-
label: 'Choice label',
|
|
1381
|
-
enabled: true
|
|
1382
|
-
},
|
|
1383
|
-
choices: {
|
|
1384
|
-
settings: true,
|
|
1385
|
-
label: 'Choices'
|
|
1386
|
-
},
|
|
1387
|
-
enableImages: {
|
|
1388
|
-
settings: true,
|
|
1389
|
-
label: 'Enable Images'
|
|
1390
|
-
},
|
|
1391
|
-
feedback: {
|
|
1392
|
-
settings: true,
|
|
1393
|
-
label: 'Feedback',
|
|
1394
|
-
enabled: true
|
|
1395
|
-
},
|
|
1396
|
-
prompt: {
|
|
1397
|
-
settings: true,
|
|
1398
|
-
label: 'Item Stem'
|
|
1399
|
-
},
|
|
1400
|
-
lockChoiceOrder: {
|
|
1401
|
-
settings: true,
|
|
1402
|
-
label: 'Lock Choice Order'
|
|
1403
|
-
},
|
|
1404
|
-
numberedGuides: {
|
|
1405
|
-
settings: true,
|
|
1406
|
-
label: 'Numbered guides'
|
|
1407
|
-
},
|
|
1408
|
-
orientation: {
|
|
1409
|
-
settings: true,
|
|
1410
|
-
label: 'Orientation'
|
|
1411
|
-
},
|
|
1412
|
-
partialScoring: {
|
|
1413
|
-
settings: false,
|
|
1414
|
-
label: 'Allow Partial Scoring'
|
|
1415
|
-
},
|
|
1416
|
-
placementArea: {
|
|
1417
|
-
settings: true,
|
|
1418
|
-
label: 'Placement Area'
|
|
1419
|
-
},
|
|
1420
|
-
rationale: {
|
|
1421
|
-
settings: true,
|
|
1422
|
-
label: 'Rationale'
|
|
1423
|
-
},
|
|
1424
|
-
removeTilesAfterPlacing: {
|
|
1425
|
-
settings: false,
|
|
1426
|
-
label: 'Remove Tiles after placing'
|
|
1427
|
-
},
|
|
1428
|
-
scoringType: {
|
|
1429
|
-
settings: false,
|
|
1430
|
-
label: 'Scoring Type'
|
|
1431
|
-
},
|
|
1432
|
-
studentInstructions: {
|
|
1433
|
-
settings: false,
|
|
1434
|
-
label: 'Student Instructions'
|
|
1435
|
-
},
|
|
1436
|
-
targetLabel: {
|
|
1437
|
-
settings: true,
|
|
1438
|
-
label: 'Target label'
|
|
1439
|
-
},
|
|
1440
|
-
teacherInstructions: {
|
|
1441
|
-
settings: true,
|
|
1442
|
-
label: 'Teacher Instructions'
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
};
|
|
1446
|
-
const {DeleteImageEvent: DeleteImageEvent} = _dll_pie_framework__pie_configure_events;
|
|
1447
|
-
const {InsertImageEvent: InsertImageEvent} = _dll_pie_framework__pie_configure_events;
|
|
1448
|
-
const {ModelUpdatedEvent: ModelUpdatedEvent} = _dll_pie_framework__pie_configure_events;
|
|
1449
|
-
const React$3 = _dll_react;
|
|
1450
|
-
const ReactDOM = _dll_react_dom;
|
|
1451
|
-
const {defaults: defaults} = _dll_lodash;
|
|
1452
|
-
const prepareCustomizationObject = (config, model) => {
|
|
1453
|
-
const configuration = defaults(config, defaultValues.configuration);
|
|
1454
|
-
return {
|
|
1455
|
-
configuration,
|
|
1456
|
-
model
|
|
1457
|
-
};
|
|
1458
|
-
};
|
|
1459
|
-
class PlacementOrdering extends HTMLElement {
|
|
1460
|
-
static __initStatic() {
|
|
1461
|
-
this.createDefaultModel = (model = {}) => {
|
|
1462
|
-
const mapChoicesToReturnCorrectResponse = choices => choices && choices.map(ch => ({
|
|
1463
|
-
id: ch.id
|
|
1464
|
-
}));
|
|
1465
|
-
let correctResponse = model.correctResponse || mapChoicesToReturnCorrectResponse(model.choices);
|
|
1466
|
-
const defaultModel = {
|
|
1467
|
-
...defaultValues.model,
|
|
1468
|
-
...model
|
|
1469
|
-
};
|
|
1470
|
-
if (correctResponse) {
|
|
1471
|
-
defaultModel.correctResponse = correctResponse;
|
|
1472
|
-
}
|
|
1473
|
-
return defaultModel;
|
|
1474
|
-
};
|
|
1475
|
-
}
|
|
1476
|
-
constructor() {
|
|
1477
|
-
super();
|
|
1478
|
-
this._model = PlacementOrdering.createDefaultModel();
|
|
1479
|
-
this._configuration = defaultValues.configuration;
|
|
1480
|
-
this.onModelChanged = (model, resetSession) => {
|
|
1481
|
-
this._model = model;
|
|
1482
|
-
this._rerender();
|
|
1483
|
-
this.dispatchUpdate(resetSession);
|
|
1484
|
-
};
|
|
1485
|
-
this.onConfigurationChanged = configuration => {
|
|
1486
|
-
this._configuration = prepareCustomizationObject(configuration).configuration;
|
|
1487
|
-
this.onModelChanged(this._model);
|
|
1488
|
-
this._rerender();
|
|
1489
|
-
};
|
|
1490
|
-
this.insertImage = handler => {
|
|
1491
|
-
this.dispatchEvent(new InsertImageEvent(handler));
|
|
1492
|
-
};
|
|
1493
|
-
this.deleteImage = (src, done) => {
|
|
1494
|
-
this.dispatchEvent(new DeleteImageEvent(src, done));
|
|
1495
|
-
};
|
|
1496
|
-
}
|
|
1497
|
-
dispatchUpdate(reset) {
|
|
1498
|
-
this.dispatchEvent(new ModelUpdatedEvent(this._model, reset));
|
|
1499
|
-
}
|
|
1500
|
-
set model(s) {
|
|
1501
|
-
this._model = PlacementOrdering.createDefaultModel(s);
|
|
1502
|
-
this._rerender();
|
|
1503
|
-
}
|
|
1504
|
-
set configuration(c) {
|
|
1505
|
-
const info = prepareCustomizationObject(c, this._model);
|
|
1506
|
-
this.onModelChanged(info.model);
|
|
1507
|
-
this._configuration = info.configuration;
|
|
1508
|
-
this._rerender();
|
|
1509
|
-
}
|
|
1510
|
-
_rerender() {
|
|
1511
|
-
let element = React$3.createElement(Main, {
|
|
1512
|
-
model: this._model,
|
|
1513
|
-
configuration: this._configuration,
|
|
1514
|
-
onModelChanged: this.onModelChanged,
|
|
1515
|
-
onConfigurationChanged: this.onConfigurationChanged,
|
|
1516
|
-
imageSupport: {
|
|
1517
|
-
add: this.insertImage,
|
|
1518
|
-
delete: this.deleteImage
|
|
1519
|
-
}
|
|
1520
|
-
});
|
|
1521
|
-
ReactDOM.render(element, this);
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
PlacementOrdering.__initStatic();
|
|
1525
|
-
export default PlacementOrdering;
|