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