@pie-element/explicit-constructed-response 3.13.3 → 4.1.0
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 +46 -0
- package/configure/CHANGELOG.md +44 -0
- package/configure/lib/defaults.js +11 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/main.js +16 -4
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/utils.js +1 -1
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +3 -3
- package/docs/config-schema.json +63 -0
- package/docs/config-schema.json.md +49 -1
- package/docs/pie-schema.json +21 -0
- package/docs/pie-schema.json.md +16 -0
- package/package.json +6 -6
- package/module/configure.js +0 -2038
- package/module/controller.js +0 -21390
- package/module/demo.js +0 -45
- package/module/element.js +0 -67787
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -83
- package/module/print.html +0 -18
- package/module/print.js +0 -67733
package/module/configure.js
DELETED
|
@@ -1,2038 +0,0 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_classnames, _dll_material_ui__core_styles, _dll_lodash, _dll_material_ui__icons, _dll_react_dom, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.19/module/index.js";
|
|
2
|
-
import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.5.6/module/index.js";
|
|
3
|
-
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.3.1/module/index.js";
|
|
4
|
-
function getDefaultExportFromCjs(x) {
|
|
5
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
6
|
-
}
|
|
7
|
-
var lib$1 = {};
|
|
8
|
-
var interopRequireDefault = {
|
|
9
|
-
exports: {}
|
|
10
|
-
};
|
|
11
|
-
(function (module) {
|
|
12
|
-
function _interopRequireDefault(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
"default": obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
(module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
18
|
-
})(interopRequireDefault);
|
|
19
|
-
getDefaultExportFromCjs(interopRequireDefault.exports);
|
|
20
|
-
var classCallCheck = {
|
|
21
|
-
exports: {}
|
|
22
|
-
};
|
|
23
|
-
(function (module) {
|
|
24
|
-
function _classCallCheck(instance, Constructor) {
|
|
25
|
-
if (!(instance instanceof Constructor)) {
|
|
26
|
-
throw new TypeError("Cannot call a class as a function");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
(module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
30
|
-
})(classCallCheck);
|
|
31
|
-
getDefaultExportFromCjs(classCallCheck.exports);
|
|
32
|
-
var createClass = {
|
|
33
|
-
exports: {}
|
|
34
|
-
};
|
|
35
|
-
(function (module) {
|
|
36
|
-
function _defineProperties(target, props) {
|
|
37
|
-
for (var i = 0; i < props.length; i++) {
|
|
38
|
-
var descriptor = props[i];
|
|
39
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
40
|
-
descriptor.configurable = true;
|
|
41
|
-
if (("value" in descriptor)) descriptor.writable = true;
|
|
42
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
46
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
47
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
48
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
49
|
-
writable: false
|
|
50
|
-
});
|
|
51
|
-
return Constructor;
|
|
52
|
-
}
|
|
53
|
-
(module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
54
|
-
})(createClass);
|
|
55
|
-
getDefaultExportFromCjs(createClass.exports);
|
|
56
|
-
var assertThisInitialized = {
|
|
57
|
-
exports: {}
|
|
58
|
-
};
|
|
59
|
-
(function (module) {
|
|
60
|
-
function _assertThisInitialized(self) {
|
|
61
|
-
if (self === void 0) {
|
|
62
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
63
|
-
}
|
|
64
|
-
return self;
|
|
65
|
-
}
|
|
66
|
-
(module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
67
|
-
})(assertThisInitialized);
|
|
68
|
-
getDefaultExportFromCjs(assertThisInitialized.exports);
|
|
69
|
-
var inherits = {
|
|
70
|
-
exports: {}
|
|
71
|
-
};
|
|
72
|
-
var setPrototypeOf = {
|
|
73
|
-
exports: {}
|
|
74
|
-
};
|
|
75
|
-
(function (module) {
|
|
76
|
-
function _setPrototypeOf(o, p) {
|
|
77
|
-
(module.exports = _setPrototypeOf = Object.setPrototypeOf || (function _setPrototypeOf(o, p) {
|
|
78
|
-
o.__proto__ = p;
|
|
79
|
-
return o;
|
|
80
|
-
}), module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
81
|
-
return _setPrototypeOf(o, p);
|
|
82
|
-
}
|
|
83
|
-
(module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
84
|
-
})(setPrototypeOf);
|
|
85
|
-
getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
86
|
-
(function (module) {
|
|
87
|
-
var setPrototypeOf$1 = setPrototypeOf.exports;
|
|
88
|
-
function _inherits(subClass, superClass) {
|
|
89
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
90
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
91
|
-
}
|
|
92
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
93
|
-
constructor: {
|
|
94
|
-
value: subClass,
|
|
95
|
-
writable: true,
|
|
96
|
-
configurable: true
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
Object.defineProperty(subClass, "prototype", {
|
|
100
|
-
writable: false
|
|
101
|
-
});
|
|
102
|
-
if (superClass) setPrototypeOf$1(subClass, superClass);
|
|
103
|
-
}
|
|
104
|
-
(module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
105
|
-
})(inherits);
|
|
106
|
-
getDefaultExportFromCjs(inherits.exports);
|
|
107
|
-
var possibleConstructorReturn = {
|
|
108
|
-
exports: {}
|
|
109
|
-
};
|
|
110
|
-
var _typeof = {
|
|
111
|
-
exports: {}
|
|
112
|
-
};
|
|
113
|
-
(function (module) {
|
|
114
|
-
function _typeof(obj) {
|
|
115
|
-
"@babel/helpers - typeof";
|
|
116
|
-
return ((module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
117
|
-
return typeof obj;
|
|
118
|
-
} : function (obj) {
|
|
119
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
120
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj));
|
|
121
|
-
}
|
|
122
|
-
(module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
123
|
-
})(_typeof);
|
|
124
|
-
getDefaultExportFromCjs(_typeof.exports);
|
|
125
|
-
(function (module) {
|
|
126
|
-
var _typeof$1 = _typeof.exports["default"];
|
|
127
|
-
var assertThisInitialized$1 = assertThisInitialized.exports;
|
|
128
|
-
function _possibleConstructorReturn(self, call) {
|
|
129
|
-
if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
|
|
130
|
-
return call;
|
|
131
|
-
} else if (call !== void 0) {
|
|
132
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
133
|
-
}
|
|
134
|
-
return assertThisInitialized$1(self);
|
|
135
|
-
}
|
|
136
|
-
(module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
137
|
-
})(possibleConstructorReturn);
|
|
138
|
-
getDefaultExportFromCjs(possibleConstructorReturn.exports);
|
|
139
|
-
var getPrototypeOf = {
|
|
140
|
-
exports: {}
|
|
141
|
-
};
|
|
142
|
-
(function (module) {
|
|
143
|
-
function _getPrototypeOf(o) {
|
|
144
|
-
(module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
145
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
146
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
147
|
-
return _getPrototypeOf(o);
|
|
148
|
-
}
|
|
149
|
-
(module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
150
|
-
})(getPrototypeOf);
|
|
151
|
-
getDefaultExportFromCjs(getPrototypeOf.exports);
|
|
152
|
-
var wrapNativeSuper = {
|
|
153
|
-
exports: {}
|
|
154
|
-
};
|
|
155
|
-
var isNativeFunction = {
|
|
156
|
-
exports: {}
|
|
157
|
-
};
|
|
158
|
-
(function (module) {
|
|
159
|
-
function _isNativeFunction(fn) {
|
|
160
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
161
|
-
}
|
|
162
|
-
(module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
163
|
-
})(isNativeFunction);
|
|
164
|
-
getDefaultExportFromCjs(isNativeFunction.exports);
|
|
165
|
-
var construct = {
|
|
166
|
-
exports: {}
|
|
167
|
-
};
|
|
168
|
-
var isNativeReflectConstruct = {
|
|
169
|
-
exports: {}
|
|
170
|
-
};
|
|
171
|
-
(function (module) {
|
|
172
|
-
function _isNativeReflectConstruct() {
|
|
173
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
174
|
-
if (Reflect.construct.sham) return false;
|
|
175
|
-
if (typeof Proxy === "function") return true;
|
|
176
|
-
try {
|
|
177
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
178
|
-
return true;
|
|
179
|
-
} catch (e) {
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
(module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
184
|
-
})(isNativeReflectConstruct);
|
|
185
|
-
getDefaultExportFromCjs(isNativeReflectConstruct.exports);
|
|
186
|
-
(function (module) {
|
|
187
|
-
var setPrototypeOf$1 = setPrototypeOf.exports;
|
|
188
|
-
var isNativeReflectConstruct$1 = isNativeReflectConstruct.exports;
|
|
189
|
-
function _construct(Parent, args, Class) {
|
|
190
|
-
if (isNativeReflectConstruct$1()) {
|
|
191
|
-
(module.exports = _construct = Reflect.construct, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
192
|
-
} else {
|
|
193
|
-
(module.exports = _construct = function _construct(Parent, args, Class) {
|
|
194
|
-
var a = [null];
|
|
195
|
-
a.push.apply(a, args);
|
|
196
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
197
|
-
var instance = new Constructor();
|
|
198
|
-
if (Class) setPrototypeOf$1(instance, Class.prototype);
|
|
199
|
-
return instance;
|
|
200
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
201
|
-
}
|
|
202
|
-
return _construct.apply(null, arguments);
|
|
203
|
-
}
|
|
204
|
-
(module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
205
|
-
})(construct);
|
|
206
|
-
getDefaultExportFromCjs(construct.exports);
|
|
207
|
-
(function (module) {
|
|
208
|
-
var getPrototypeOf$1 = getPrototypeOf.exports;
|
|
209
|
-
var setPrototypeOf$1 = setPrototypeOf.exports;
|
|
210
|
-
var isNativeFunction$1 = isNativeFunction.exports;
|
|
211
|
-
var construct$1 = construct.exports;
|
|
212
|
-
function _wrapNativeSuper(Class) {
|
|
213
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
214
|
-
(module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
215
|
-
if (Class === null || !isNativeFunction$1(Class)) return Class;
|
|
216
|
-
if (typeof Class !== "function") {
|
|
217
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
218
|
-
}
|
|
219
|
-
if (typeof _cache !== "undefined") {
|
|
220
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
221
|
-
_cache.set(Class, Wrapper);
|
|
222
|
-
}
|
|
223
|
-
function Wrapper() {
|
|
224
|
-
return construct$1(Class, arguments, getPrototypeOf$1(this).constructor);
|
|
225
|
-
}
|
|
226
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
227
|
-
constructor: {
|
|
228
|
-
value: Wrapper,
|
|
229
|
-
enumerable: false,
|
|
230
|
-
writable: true,
|
|
231
|
-
configurable: true
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
return setPrototypeOf$1(Wrapper, Class);
|
|
235
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
236
|
-
return _wrapNativeSuper(Class);
|
|
237
|
-
}
|
|
238
|
-
(module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
239
|
-
})(wrapNativeSuper);
|
|
240
|
-
getDefaultExportFromCjs(wrapNativeSuper.exports);
|
|
241
|
-
var defineProperty = {
|
|
242
|
-
exports: {}
|
|
243
|
-
};
|
|
244
|
-
(function (module) {
|
|
245
|
-
function _defineProperty(obj, key, value) {
|
|
246
|
-
if ((key in obj)) {
|
|
247
|
-
Object.defineProperty(obj, key, {
|
|
248
|
-
value: value,
|
|
249
|
-
enumerable: true,
|
|
250
|
-
configurable: true,
|
|
251
|
-
writable: true
|
|
252
|
-
});
|
|
253
|
-
} else {
|
|
254
|
-
obj[key] = value;
|
|
255
|
-
}
|
|
256
|
-
return obj;
|
|
257
|
-
}
|
|
258
|
-
(module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
259
|
-
})(defineProperty);
|
|
260
|
-
getDefaultExportFromCjs(defineProperty.exports);
|
|
261
|
-
var lib = {};
|
|
262
|
-
Object.defineProperty(lib, "__esModule", {
|
|
263
|
-
value: true
|
|
264
|
-
});
|
|
265
|
-
class ModelUpdatedEvent extends CustomEvent {
|
|
266
|
-
constructor(update, reset = false) {
|
|
267
|
-
super(ModelUpdatedEvent.TYPE, {
|
|
268
|
-
bubbles: true,
|
|
269
|
-
detail: {
|
|
270
|
-
update,
|
|
271
|
-
reset
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
this.update = update;
|
|
275
|
-
this.reset = reset;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
ModelUpdatedEvent.TYPE = 'model.updated';
|
|
279
|
-
lib.ModelUpdatedEvent = ModelUpdatedEvent;
|
|
280
|
-
class DeleteImageEvent extends CustomEvent {
|
|
281
|
-
constructor(src, done) {
|
|
282
|
-
super(DeleteImageEvent.TYPE, {
|
|
283
|
-
bubbles: true,
|
|
284
|
-
detail: {
|
|
285
|
-
src,
|
|
286
|
-
done
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
this.src = src;
|
|
290
|
-
this.done = done;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
DeleteImageEvent.TYPE = 'delete.image';
|
|
294
|
-
lib.DeleteImageEvent = DeleteImageEvent;
|
|
295
|
-
class InsertImageEvent extends CustomEvent {
|
|
296
|
-
constructor(handler) {
|
|
297
|
-
super(InsertImageEvent.TYPE, {
|
|
298
|
-
bubbles: true,
|
|
299
|
-
detail: handler
|
|
300
|
-
});
|
|
301
|
-
this.handler = handler;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
InsertImageEvent.TYPE = 'insert.image';
|
|
305
|
-
lib.InsertImageEvent = InsertImageEvent;
|
|
306
|
-
var main = {};
|
|
307
|
-
var toConsumableArray = {
|
|
308
|
-
exports: {}
|
|
309
|
-
};
|
|
310
|
-
var arrayWithoutHoles = {
|
|
311
|
-
exports: {}
|
|
312
|
-
};
|
|
313
|
-
var arrayLikeToArray = {
|
|
314
|
-
exports: {}
|
|
315
|
-
};
|
|
316
|
-
(function (module) {
|
|
317
|
-
function _arrayLikeToArray(arr, len) {
|
|
318
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
319
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
320
|
-
arr2[i] = arr[i];
|
|
321
|
-
}
|
|
322
|
-
return arr2;
|
|
323
|
-
}
|
|
324
|
-
(module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
325
|
-
})(arrayLikeToArray);
|
|
326
|
-
getDefaultExportFromCjs(arrayLikeToArray.exports);
|
|
327
|
-
(function (module) {
|
|
328
|
-
var arrayLikeToArray$1 = arrayLikeToArray.exports;
|
|
329
|
-
function _arrayWithoutHoles(arr) {
|
|
330
|
-
if (Array.isArray(arr)) return arrayLikeToArray$1(arr);
|
|
331
|
-
}
|
|
332
|
-
(module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
333
|
-
})(arrayWithoutHoles);
|
|
334
|
-
getDefaultExportFromCjs(arrayWithoutHoles.exports);
|
|
335
|
-
var iterableToArray = {
|
|
336
|
-
exports: {}
|
|
337
|
-
};
|
|
338
|
-
(function (module) {
|
|
339
|
-
function _iterableToArray(iter) {
|
|
340
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
341
|
-
}
|
|
342
|
-
(module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
343
|
-
})(iterableToArray);
|
|
344
|
-
getDefaultExportFromCjs(iterableToArray.exports);
|
|
345
|
-
var unsupportedIterableToArray = {
|
|
346
|
-
exports: {}
|
|
347
|
-
};
|
|
348
|
-
(function (module) {
|
|
349
|
-
var arrayLikeToArray$1 = arrayLikeToArray.exports;
|
|
350
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
351
|
-
if (!o) return;
|
|
352
|
-
if (typeof o === "string") return arrayLikeToArray$1(o, minLen);
|
|
353
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
354
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
355
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
356
|
-
if (n === "Arguments" || (/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/).test(n)) return arrayLikeToArray$1(o, minLen);
|
|
357
|
-
}
|
|
358
|
-
(module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
359
|
-
})(unsupportedIterableToArray);
|
|
360
|
-
getDefaultExportFromCjs(unsupportedIterableToArray.exports);
|
|
361
|
-
var nonIterableSpread = {
|
|
362
|
-
exports: {}
|
|
363
|
-
};
|
|
364
|
-
(function (module) {
|
|
365
|
-
function _nonIterableSpread() {
|
|
366
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
367
|
-
}
|
|
368
|
-
(module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
369
|
-
})(nonIterableSpread);
|
|
370
|
-
getDefaultExportFromCjs(nonIterableSpread.exports);
|
|
371
|
-
(function (module) {
|
|
372
|
-
var arrayWithoutHoles$1 = arrayWithoutHoles.exports;
|
|
373
|
-
var iterableToArray$1 = iterableToArray.exports;
|
|
374
|
-
var unsupportedIterableToArray$1 = unsupportedIterableToArray.exports;
|
|
375
|
-
var nonIterableSpread$1 = nonIterableSpread.exports;
|
|
376
|
-
function _toConsumableArray(arr) {
|
|
377
|
-
return arrayWithoutHoles$1(arr) || iterableToArray$1(arr) || unsupportedIterableToArray$1(arr) || nonIterableSpread$1();
|
|
378
|
-
}
|
|
379
|
-
(module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
380
|
-
})(toConsumableArray);
|
|
381
|
-
getDefaultExportFromCjs(toConsumableArray.exports);
|
|
382
|
-
var ecrToolbar = {};
|
|
383
|
-
const require$$8 = _dll_react;
|
|
384
|
-
const require$$9$3 = _dll_prop_types;
|
|
385
|
-
const require$$10$4 = _dll_material_ui__core_styles;
|
|
386
|
-
const {OutlinedInput: require$$11$4} = _dll_material_ui__core;
|
|
387
|
-
const require$$12$4 = _dll_classnames;
|
|
388
|
-
(function (exports) {
|
|
389
|
-
var _interopRequireDefault = interopRequireDefault.exports;
|
|
390
|
-
Object.defineProperty(exports, "__esModule", {
|
|
391
|
-
value: true
|
|
392
|
-
});
|
|
393
|
-
exports["default"] = exports.ECRToolbar = void 0;
|
|
394
|
-
var _classCallCheck2 = _interopRequireDefault(classCallCheck.exports);
|
|
395
|
-
var _createClass2 = _interopRequireDefault(createClass.exports);
|
|
396
|
-
var _assertThisInitialized2 = _interopRequireDefault(assertThisInitialized.exports);
|
|
397
|
-
var _inherits2 = _interopRequireDefault(inherits.exports);
|
|
398
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(possibleConstructorReturn.exports);
|
|
399
|
-
var _getPrototypeOf2 = _interopRequireDefault(getPrototypeOf.exports);
|
|
400
|
-
var _defineProperty2 = _interopRequireDefault(defineProperty.exports);
|
|
401
|
-
var _react = _interopRequireDefault(require$$8);
|
|
402
|
-
var _propTypes = _interopRequireDefault(require$$9$3);
|
|
403
|
-
var _styles = require$$10$4;
|
|
404
|
-
var _OutlinedInput = _interopRequireDefault(require$$11$4);
|
|
405
|
-
_interopRequireDefault(require$$12$4);
|
|
406
|
-
function ownKeys(object, enumerableOnly) {
|
|
407
|
-
var keys = Object.keys(object);
|
|
408
|
-
if (Object.getOwnPropertySymbols) {
|
|
409
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
410
|
-
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
411
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
412
|
-
})), keys.push.apply(keys, symbols));
|
|
413
|
-
}
|
|
414
|
-
return keys;
|
|
415
|
-
}
|
|
416
|
-
function _objectSpread(target) {
|
|
417
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
418
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
419
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
420
|
-
(0, _defineProperty2["default"])(target, key, source[key]);
|
|
421
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
422
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
return target;
|
|
426
|
-
}
|
|
427
|
-
function _createSuper(Derived) {
|
|
428
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
429
|
-
return function _createSuperInternal() {
|
|
430
|
-
var Super = (0, _getPrototypeOf2["default"])(Derived), result;
|
|
431
|
-
if (hasNativeReflectConstruct) {
|
|
432
|
-
var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
|
|
433
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
434
|
-
} else {
|
|
435
|
-
result = Super.apply(this, arguments);
|
|
436
|
-
}
|
|
437
|
-
return (0, _possibleConstructorReturn2["default"])(this, result);
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
function _isNativeReflectConstruct() {
|
|
441
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
442
|
-
if (Reflect.construct.sham) return false;
|
|
443
|
-
if (typeof Proxy === "function") return true;
|
|
444
|
-
try {
|
|
445
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
446
|
-
return true;
|
|
447
|
-
} catch (e) {
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
var findSlateNode = function findSlateNode(key) {
|
|
452
|
-
return window.document.querySelector('[data-key="' + key + '"]');
|
|
453
|
-
};
|
|
454
|
-
var ECRToolbar = (function (_React$Component) {
|
|
455
|
-
(0, _inherits2["default"])(ECRToolbar, _React$Component);
|
|
456
|
-
var _super = _createSuper(ECRToolbar);
|
|
457
|
-
function ECRToolbar() {
|
|
458
|
-
var _this;
|
|
459
|
-
(0, _classCallCheck2["default"])(this, ECRToolbar);
|
|
460
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
461
|
-
args[_key] = arguments[_key];
|
|
462
|
-
}
|
|
463
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
464
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
465
|
-
markup: ''
|
|
466
|
-
});
|
|
467
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDone", function () {
|
|
468
|
-
var newValue = _this.state.markup;
|
|
469
|
-
var _this$props = _this.props, node = _this$props.node, value = _this$props.value, onToolbarDone = _this$props.onToolbarDone, onChangeResponse = _this$props.onChangeResponse;
|
|
470
|
-
var update = _objectSpread(_objectSpread({}, node.data.toJSON()), {}, {
|
|
471
|
-
value: newValue
|
|
472
|
-
});
|
|
473
|
-
var change = value.change().setNodeByKey(node.key, {
|
|
474
|
-
data: update
|
|
475
|
-
});
|
|
476
|
-
var nextText = value.document.getNextText(node.key);
|
|
477
|
-
change.moveFocusTo(nextText.key, 0).moveAnchorTo(nextText.key, 0);
|
|
478
|
-
onToolbarDone(change, true);
|
|
479
|
-
onChangeResponse(newValue);
|
|
480
|
-
});
|
|
481
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (e) {
|
|
482
|
-
return _this.setState({
|
|
483
|
-
markup: e.target.value
|
|
484
|
-
});
|
|
485
|
-
});
|
|
486
|
-
return _this;
|
|
487
|
-
}
|
|
488
|
-
(0, _createClass2["default"])(ECRToolbar, [{
|
|
489
|
-
key: "componentDidMount",
|
|
490
|
-
value: function componentDidMount() {
|
|
491
|
-
var _this$props2 = this.props, correctChoice = _this$props2.correctChoice, node = _this$props2.node;
|
|
492
|
-
var choice = correctChoice || ({});
|
|
493
|
-
var domNode = findSlateNode(node.key);
|
|
494
|
-
if (domNode) {
|
|
495
|
-
var domNodeRect = domNode.getBoundingClientRect();
|
|
496
|
-
var editor = domNode.closest('[data-slate-editor]');
|
|
497
|
-
var editorRect = editor.getBoundingClientRect();
|
|
498
|
-
var top = domNodeRect.top - editorRect.top;
|
|
499
|
-
var left = domNodeRect.left - editorRect.left;
|
|
500
|
-
this.setState({
|
|
501
|
-
markup: choice.label,
|
|
502
|
-
toolbarStyle: {
|
|
503
|
-
position: 'absolute',
|
|
504
|
-
top: ("").concat(top + domNodeRect.height + 20, "px"),
|
|
505
|
-
left: ("").concat(left + 20, "px"),
|
|
506
|
-
width: domNodeRect.width
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}, {
|
|
512
|
-
key: "render",
|
|
513
|
-
value: function render() {
|
|
514
|
-
var _this$props3 = this.props, classes = _this$props3.classes;
|
|
515
|
-
_this$props3.error;
|
|
516
|
-
var _this$state = this.state, markup = _this$state.markup, toolbarStyle = _this$state.toolbarStyle;
|
|
517
|
-
return _react["default"].createElement("div", {
|
|
518
|
-
style: _objectSpread(_objectSpread({}, toolbarStyle), {}, {
|
|
519
|
-
backgroundColor: '#E0E1E6'
|
|
520
|
-
})
|
|
521
|
-
}, _react["default"].createElement(_OutlinedInput["default"], {
|
|
522
|
-
style: {
|
|
523
|
-
width: '100%'
|
|
524
|
-
},
|
|
525
|
-
autoFocus: true,
|
|
526
|
-
labelWidth: 0,
|
|
527
|
-
classes: {
|
|
528
|
-
input: classes.input
|
|
529
|
-
},
|
|
530
|
-
onChange: this.onChange,
|
|
531
|
-
onBlur: this.onDone,
|
|
532
|
-
value: markup || ''
|
|
533
|
-
}));
|
|
534
|
-
}
|
|
535
|
-
}]);
|
|
536
|
-
return ECRToolbar;
|
|
537
|
-
})(_react["default"].Component);
|
|
538
|
-
exports.ECRToolbar = ECRToolbar;
|
|
539
|
-
(0, _defineProperty2["default"])(ECRToolbar, "propTypes", {
|
|
540
|
-
correctChoice: _propTypes["default"].object,
|
|
541
|
-
classes: _propTypes["default"].object,
|
|
542
|
-
node: _propTypes["default"].object,
|
|
543
|
-
onDone: _propTypes["default"].func,
|
|
544
|
-
onChangeResponse: _propTypes["default"].func.isRequired,
|
|
545
|
-
onToolbarDone: _propTypes["default"].func.isRequired,
|
|
546
|
-
value: _propTypes["default"].shape({
|
|
547
|
-
change: _propTypes["default"].func.isRequired,
|
|
548
|
-
document: _propTypes["default"].shape({
|
|
549
|
-
getNextText: _propTypes["default"].func.isRequired
|
|
550
|
-
})
|
|
551
|
-
})
|
|
552
|
-
});
|
|
553
|
-
var StyledECRToolbar = (0, _styles.withStyles)({
|
|
554
|
-
respArea: {
|
|
555
|
-
backgroundColor: '#fff'
|
|
556
|
-
},
|
|
557
|
-
input: {
|
|
558
|
-
backgroundColor: '#fff',
|
|
559
|
-
padding: '10px 20px 10px 10px'
|
|
560
|
-
},
|
|
561
|
-
errorInput: {
|
|
562
|
-
border: '2px solid red'
|
|
563
|
-
}
|
|
564
|
-
})(ECRToolbar);
|
|
565
|
-
var _default = StyledECRToolbar;
|
|
566
|
-
exports["default"] = _default;
|
|
567
|
-
})(ecrToolbar);
|
|
568
|
-
getDefaultExportFromCjs(ecrToolbar);
|
|
569
|
-
var alternateResponses = {};
|
|
570
|
-
var alternateSection = {};
|
|
571
|
-
var markupUtils = {};
|
|
572
|
-
const {escape: require$$1} = _dll_lodash;
|
|
573
|
-
var _interopRequireDefault = interopRequireDefault.exports;
|
|
574
|
-
Object.defineProperty(markupUtils, "__esModule", {
|
|
575
|
-
value: true
|
|
576
|
-
});
|
|
577
|
-
markupUtils.removeUnwantedCharacters = markupUtils.processMarkup = markupUtils.getAdjustedLength = markupUtils.createSlateMarkup = void 0;
|
|
578
|
-
var _escape = _interopRequireDefault(require$$1);
|
|
579
|
-
var tSymbols = 'imes|riangle|an|heta|herefore';
|
|
580
|
-
var nSymbols = 'throot|parallel|cong|approx|eq|e|sim';
|
|
581
|
-
var matchTabAndNewLine = new RegExp(("(\\t(?!").concat(tSymbols, "))|(\\n(?!").concat(nSymbols, "))|(\\\\t(?!").concat(tSymbols, "))|(\\\\n(?!").concat(nSymbols, "))"), 'g');
|
|
582
|
-
var removeUnwantedCharacters = function removeUnwantedCharacters(markup) {
|
|
583
|
-
return markup.replace(matchTabAndNewLine, '').replace(/\\"/g, '"').replace(/\\\//g, '/');
|
|
584
|
-
};
|
|
585
|
-
markupUtils.removeUnwantedCharacters = removeUnwantedCharacters;
|
|
586
|
-
var createElementFromHTML = function createElementFromHTML() {
|
|
587
|
-
var htmlString = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
588
|
-
var div = document.createElement('div');
|
|
589
|
-
div.innerHTML = htmlString.trim();
|
|
590
|
-
return div;
|
|
591
|
-
};
|
|
592
|
-
var processMarkup = function processMarkup(markup) {
|
|
593
|
-
var newMarkup = removeUnwantedCharacters(markup || '');
|
|
594
|
-
var slateMarkup = createElementFromHTML(newMarkup || '');
|
|
595
|
-
var index = 0;
|
|
596
|
-
slateMarkup.querySelectorAll('[data-type="explicit_constructed_response"]').forEach(function (s) {
|
|
597
|
-
s.replaceWith(("{{").concat(index++, "}}"));
|
|
598
|
-
});
|
|
599
|
-
return slateMarkup.innerHTML;
|
|
600
|
-
};
|
|
601
|
-
markupUtils.processMarkup = processMarkup;
|
|
602
|
-
var REGEX = /\{\{(\d+)\}\}/g;
|
|
603
|
-
var createSlateMarkup = function createSlateMarkup(markup, choices) {
|
|
604
|
-
if (!markup) {
|
|
605
|
-
return '';
|
|
606
|
-
}
|
|
607
|
-
var newMarkup = removeUnwantedCharacters(markup);
|
|
608
|
-
return newMarkup.replace(REGEX, function (match, g) {
|
|
609
|
-
var label = choices[g][0].label || '';
|
|
610
|
-
return ("<span data-type=\"explicit_constructed_response\" data-index=\"").concat(g, "\" data-value=\"").concat((0, _escape["default"])(label), "\"></span>");
|
|
611
|
-
});
|
|
612
|
-
};
|
|
613
|
-
markupUtils.createSlateMarkup = createSlateMarkup;
|
|
614
|
-
var getAdjustedLength = function getAdjustedLength(length) {
|
|
615
|
-
if (length <= 2) {
|
|
616
|
-
return length + 2;
|
|
617
|
-
}
|
|
618
|
-
if (length <= 4) {
|
|
619
|
-
return length + 3;
|
|
620
|
-
}
|
|
621
|
-
if (length <= 6) {
|
|
622
|
-
return length + 4;
|
|
623
|
-
}
|
|
624
|
-
return length + 5;
|
|
625
|
-
};
|
|
626
|
-
markupUtils.getAdjustedLength = getAdjustedLength;
|
|
627
|
-
const require$$9$2 = _dll_react;
|
|
628
|
-
const require$$10$3 = _dll_prop_types;
|
|
629
|
-
const {debounce: require$$11$3} = _dll_lodash;
|
|
630
|
-
const {isEqual: require$$12$3} = _dll_lodash;
|
|
631
|
-
const {max: require$$21$1} = _dll_lodash;
|
|
632
|
-
const {OutlinedInput: require$$13$3} = _dll_material_ui__core;
|
|
633
|
-
const {Button: require$$14$2} = _dll_material_ui__core;
|
|
634
|
-
const {IconButton: require$$16$1} = _dll_material_ui__core;
|
|
635
|
-
const {MenuItem: require$$17$1} = _dll_material_ui__core;
|
|
636
|
-
const {Select: require$$18$1} = _dll_material_ui__core;
|
|
637
|
-
const {TextField: require$$19$1} = _dll_material_ui__core;
|
|
638
|
-
const {Delete: require$$15$1} = _dll_material_ui__icons;
|
|
639
|
-
const require$$20$1 = _dll_material_ui__core_styles;
|
|
640
|
-
const require$$22 = _dll_classnames;
|
|
641
|
-
(function (exports) {
|
|
642
|
-
var _interopRequireDefault = interopRequireDefault.exports;
|
|
643
|
-
Object.defineProperty(exports, "__esModule", {
|
|
644
|
-
value: true
|
|
645
|
-
});
|
|
646
|
-
exports["default"] = exports.Choice = exports.AlternateSection = void 0;
|
|
647
|
-
var _toConsumableArray2 = _interopRequireDefault(toConsumableArray.exports);
|
|
648
|
-
var _classCallCheck2 = _interopRequireDefault(classCallCheck.exports);
|
|
649
|
-
var _createClass2 = _interopRequireDefault(createClass.exports);
|
|
650
|
-
var _assertThisInitialized2 = _interopRequireDefault(assertThisInitialized.exports);
|
|
651
|
-
var _inherits2 = _interopRequireDefault(inherits.exports);
|
|
652
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(possibleConstructorReturn.exports);
|
|
653
|
-
var _getPrototypeOf2 = _interopRequireDefault(getPrototypeOf.exports);
|
|
654
|
-
var _defineProperty2 = _interopRequireDefault(defineProperty.exports);
|
|
655
|
-
var _react = _interopRequireDefault(require$$9$2);
|
|
656
|
-
var _propTypes = _interopRequireDefault(require$$10$3);
|
|
657
|
-
var _debounce = _interopRequireDefault(require$$11$3);
|
|
658
|
-
var _isEqual = _interopRequireDefault(require$$12$3);
|
|
659
|
-
var _OutlinedInput = _interopRequireDefault(require$$13$3);
|
|
660
|
-
var _Button = _interopRequireDefault(require$$14$2);
|
|
661
|
-
var _Delete = _interopRequireDefault(require$$15$1);
|
|
662
|
-
var _IconButton = _interopRequireDefault(require$$16$1);
|
|
663
|
-
var _MenuItem = _interopRequireDefault(require$$17$1);
|
|
664
|
-
var _Select = _interopRequireDefault(require$$18$1);
|
|
665
|
-
var _TextField = _interopRequireDefault(require$$19$1);
|
|
666
|
-
var _styles = require$$20$1;
|
|
667
|
-
var _max = _interopRequireDefault(require$$21$1);
|
|
668
|
-
var _classnames = _interopRequireDefault(require$$22);
|
|
669
|
-
var _markupUtils = markupUtils;
|
|
670
|
-
function ownKeys(object, enumerableOnly) {
|
|
671
|
-
var keys = Object.keys(object);
|
|
672
|
-
if (Object.getOwnPropertySymbols) {
|
|
673
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
674
|
-
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
675
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
676
|
-
})), keys.push.apply(keys, symbols));
|
|
677
|
-
}
|
|
678
|
-
return keys;
|
|
679
|
-
}
|
|
680
|
-
function _objectSpread(target) {
|
|
681
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
682
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
683
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
684
|
-
(0, _defineProperty2["default"])(target, key, source[key]);
|
|
685
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
686
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
return target;
|
|
690
|
-
}
|
|
691
|
-
function _createSuper(Derived) {
|
|
692
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
693
|
-
return function _createSuperInternal() {
|
|
694
|
-
var Super = (0, _getPrototypeOf2["default"])(Derived), result;
|
|
695
|
-
if (hasNativeReflectConstruct) {
|
|
696
|
-
var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
|
|
697
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
698
|
-
} else {
|
|
699
|
-
result = Super.apply(this, arguments);
|
|
700
|
-
}
|
|
701
|
-
return (0, _possibleConstructorReturn2["default"])(this, result);
|
|
702
|
-
};
|
|
703
|
-
}
|
|
704
|
-
function _isNativeReflectConstruct() {
|
|
705
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
706
|
-
if (Reflect.construct.sham) return false;
|
|
707
|
-
if (typeof Proxy === "function") return true;
|
|
708
|
-
try {
|
|
709
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
710
|
-
return true;
|
|
711
|
-
} catch (e) {
|
|
712
|
-
return false;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
var styles = function styles() {
|
|
716
|
-
return {
|
|
717
|
-
altChoices: {
|
|
718
|
-
alignItems: 'flex-start',
|
|
719
|
-
flexDirection: 'column',
|
|
720
|
-
display: 'flex',
|
|
721
|
-
padding: '20px 0 0 0',
|
|
722
|
-
'& > *': {
|
|
723
|
-
marginBottom: '20px',
|
|
724
|
-
width: '100%'
|
|
725
|
-
}
|
|
726
|
-
},
|
|
727
|
-
choice: {
|
|
728
|
-
flex: '1',
|
|
729
|
-
marginRight: '20px'
|
|
730
|
-
},
|
|
731
|
-
deleteBtn: {
|
|
732
|
-
fill: 'gray'
|
|
733
|
-
},
|
|
734
|
-
selectContainer: {
|
|
735
|
-
alignItems: 'flex-end',
|
|
736
|
-
display: 'flex',
|
|
737
|
-
justifyContent: 'space-between',
|
|
738
|
-
width: '100%'
|
|
739
|
-
},
|
|
740
|
-
rightContainer: {
|
|
741
|
-
alignItems: 'center',
|
|
742
|
-
display: 'flex'
|
|
743
|
-
},
|
|
744
|
-
lengthField: {
|
|
745
|
-
width: '230px',
|
|
746
|
-
marginRight: '20px'
|
|
747
|
-
},
|
|
748
|
-
errorText: {
|
|
749
|
-
fontSize: '12px',
|
|
750
|
-
color: 'red',
|
|
751
|
-
paddingTop: '5px'
|
|
752
|
-
},
|
|
753
|
-
inputError: {
|
|
754
|
-
border: '2px solid red',
|
|
755
|
-
borderRadius: '6px'
|
|
756
|
-
}
|
|
757
|
-
};
|
|
758
|
-
};
|
|
759
|
-
var Choice = (function (_React$Component) {
|
|
760
|
-
(0, _inherits2["default"])(Choice, _React$Component);
|
|
761
|
-
var _super = _createSuper(Choice);
|
|
762
|
-
function Choice() {
|
|
763
|
-
var _this;
|
|
764
|
-
(0, _classCallCheck2["default"])(this, Choice);
|
|
765
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
766
|
-
args[_key] = arguments[_key];
|
|
767
|
-
}
|
|
768
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
769
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
770
|
-
value: _this.props.markup
|
|
771
|
-
});
|
|
772
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateText", (0, _debounce["default"])(_this.props.onChange, 300));
|
|
773
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (e) {
|
|
774
|
-
var value = e.target.value;
|
|
775
|
-
_this.setState({
|
|
776
|
-
value: value
|
|
777
|
-
});
|
|
778
|
-
_this.updateText(value);
|
|
779
|
-
});
|
|
780
|
-
return _this;
|
|
781
|
-
}
|
|
782
|
-
(0, _createClass2["default"])(Choice, [{
|
|
783
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
784
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
785
|
-
if (nextProps.markup) {
|
|
786
|
-
this.setState({
|
|
787
|
-
value: nextProps.markup
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
}, {
|
|
792
|
-
key: "render",
|
|
793
|
-
value: function render() {
|
|
794
|
-
var value = this.state.value;
|
|
795
|
-
var _this$props = this.props, classes = _this$props.classes, onDelete = _this$props.onDelete, spellCheck = _this$props.spellCheck, error = _this$props.error;
|
|
796
|
-
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("div", {
|
|
797
|
-
style: {
|
|
798
|
-
alignItems: 'center',
|
|
799
|
-
display: 'flex',
|
|
800
|
-
justifyContent: 'space-between'
|
|
801
|
-
}
|
|
802
|
-
}, _react["default"].createElement(_OutlinedInput["default"], {
|
|
803
|
-
className: (0, _classnames["default"])(classes.choice, error && classes.inputError),
|
|
804
|
-
value: value,
|
|
805
|
-
onChange: this.onChange,
|
|
806
|
-
labelWidth: 0,
|
|
807
|
-
disableUnderline: true,
|
|
808
|
-
spellCheck: spellCheck
|
|
809
|
-
}), _react["default"].createElement(_IconButton["default"], {
|
|
810
|
-
"aria-label": "delete",
|
|
811
|
-
className: classes.deleteBtn,
|
|
812
|
-
onClick: onDelete
|
|
813
|
-
}, _react["default"].createElement(_Delete["default"], null))), error && _react["default"].createElement("div", {
|
|
814
|
-
className: classes.errorText
|
|
815
|
-
}, error));
|
|
816
|
-
}
|
|
817
|
-
}]);
|
|
818
|
-
return Choice;
|
|
819
|
-
})(_react["default"].Component);
|
|
820
|
-
exports.Choice = Choice;
|
|
821
|
-
(0, _defineProperty2["default"])(Choice, "propTypes", {
|
|
822
|
-
classes: _propTypes["default"].object,
|
|
823
|
-
markup: _propTypes["default"].string,
|
|
824
|
-
onChange: _propTypes["default"].func.isRequired,
|
|
825
|
-
onDelete: _propTypes["default"].func.isRequired,
|
|
826
|
-
value: _propTypes["default"].string
|
|
827
|
-
});
|
|
828
|
-
var AlternateSection = (function (_React$Component2) {
|
|
829
|
-
(0, _inherits2["default"])(AlternateSection, _React$Component2);
|
|
830
|
-
var _super2 = _createSuper(AlternateSection);
|
|
831
|
-
function AlternateSection() {
|
|
832
|
-
var _this2;
|
|
833
|
-
(0, _classCallCheck2["default"])(this, AlternateSection);
|
|
834
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
835
|
-
args[_key2] = arguments[_key2];
|
|
836
|
-
}
|
|
837
|
-
_this2 = _super2.call.apply(_super2, [this].concat(args));
|
|
838
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "state", {});
|
|
839
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "updateChoicesIfNeeded", function (props) {
|
|
840
|
-
if (!_this2.state.choices || !(0, _isEqual["default"])(props.choices, _this2.state.choices) || !(0, _isEqual["default"])(props.choices, _this2.props.choices)) {
|
|
841
|
-
_this2.setState({
|
|
842
|
-
choices: props.choices
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
});
|
|
846
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "handleSelect", function (e) {
|
|
847
|
-
var _this2$props = _this2.props, onSelect = _this2$props.onSelect, selectChoices = _this2$props.selectChoices;
|
|
848
|
-
var value = e.target.value;
|
|
849
|
-
onSelect(selectChoices.find(function (c) {
|
|
850
|
-
return c.value === value;
|
|
851
|
-
}));
|
|
852
|
-
});
|
|
853
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onAddChoice", function () {
|
|
854
|
-
var choices = _this2.state.choices;
|
|
855
|
-
if (choices.length && choices[choices.length - 1].label !== '') {
|
|
856
|
-
var value = (0, _max["default"])(choices.map(function (c) {
|
|
857
|
-
return parseInt(c.value);
|
|
858
|
-
}).filter(function (id) {
|
|
859
|
-
return !isNaN(id);
|
|
860
|
-
})) || 0;
|
|
861
|
-
_this2.setState({
|
|
862
|
-
choices: [].concat((0, _toConsumableArray2["default"])(choices), [{
|
|
863
|
-
value: ("").concat(value + 1),
|
|
864
|
-
label: ''
|
|
865
|
-
}])
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
});
|
|
869
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onChoiceChanged", function (choice, value, index) {
|
|
870
|
-
var _this2$props2 = _this2.props, choiceChanged = _this2$props2.choiceChanged, lengthChanged = _this2$props2.lengthChanged, maxLength = _this2$props2.maxLength, choices = _this2$props2.choices;
|
|
871
|
-
var labelLengthsArr = choices.map(function (choice) {
|
|
872
|
-
return (choice.label || '').length;
|
|
873
|
-
});
|
|
874
|
-
labelLengthsArr[index] = value.length;
|
|
875
|
-
var newLength = Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr));
|
|
876
|
-
choiceChanged(_objectSpread(_objectSpread({}, choice), {}, {
|
|
877
|
-
label: value
|
|
878
|
-
}));
|
|
879
|
-
if (newLength > maxLength || newLength + 10 <= maxLength) {
|
|
880
|
-
lengthChanged((0, _markupUtils.getAdjustedLength)(newLength));
|
|
881
|
-
}
|
|
882
|
-
});
|
|
883
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onRemoveChoice", function (choice) {
|
|
884
|
-
var choiceRemoved = _this2.props.choiceRemoved;
|
|
885
|
-
choiceRemoved(choice.value);
|
|
886
|
-
});
|
|
887
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getChoicesMaxLength", function () {
|
|
888
|
-
var choices = _this2.state.choices;
|
|
889
|
-
if (!choices) {
|
|
890
|
-
return 1;
|
|
891
|
-
}
|
|
892
|
-
var labelLengthsArr = choices.map(function (choice) {
|
|
893
|
-
return (choice.label || '').length;
|
|
894
|
-
});
|
|
895
|
-
return Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr));
|
|
896
|
-
});
|
|
897
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "changeLength", function (event) {
|
|
898
|
-
var lengthChanged = _this2.props.lengthChanged;
|
|
899
|
-
var numberValue = parseInt(event.target.value, 10);
|
|
900
|
-
var minLength = _this2.getChoicesMaxLength();
|
|
901
|
-
if (numberValue && numberValue >= minLength && numberValue <= minLength + 10) {
|
|
902
|
-
lengthChanged(numberValue);
|
|
903
|
-
}
|
|
904
|
-
});
|
|
905
|
-
return _this2;
|
|
906
|
-
}
|
|
907
|
-
(0, _createClass2["default"])(AlternateSection, [{
|
|
908
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
909
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
910
|
-
this.updateChoicesIfNeeded(nextProps);
|
|
911
|
-
}
|
|
912
|
-
}, {
|
|
913
|
-
key: "componentDidMount",
|
|
914
|
-
value: function componentDidMount() {
|
|
915
|
-
this.updateChoicesIfNeeded(this.props);
|
|
916
|
-
}
|
|
917
|
-
}, {
|
|
918
|
-
key: "render",
|
|
919
|
-
value: function render() {
|
|
920
|
-
var _this3 = this;
|
|
921
|
-
var _this$props2 = this.props, classes = _this$props2.classes, selectChoices = _this$props2.selectChoices, maxLength = _this$props2.maxLength, showMaxLength = _this$props2.showMaxLength, value = _this$props2.value, spellCheck = _this$props2.spellCheck, errors = _this$props2.errors;
|
|
922
|
-
var choices = this.state.choices;
|
|
923
|
-
var minLength = this.getChoicesMaxLength();
|
|
924
|
-
return _react["default"].createElement("div", {
|
|
925
|
-
className: classes.design
|
|
926
|
-
}, _react["default"].createElement("div", {
|
|
927
|
-
className: classes.selectContainer
|
|
928
|
-
}, _react["default"].createElement(_Select["default"], {
|
|
929
|
-
className: classes.select,
|
|
930
|
-
displayEmpty: true,
|
|
931
|
-
onChange: this.handleSelect,
|
|
932
|
-
value: value || '',
|
|
933
|
-
readOnly: showMaxLength
|
|
934
|
-
}, _react["default"].createElement(_MenuItem["default"], {
|
|
935
|
-
value: ""
|
|
936
|
-
}, _react["default"].createElement("em", null, value ? 'Remove selection' : 'Select a response')), selectChoices.map(function (c, index) {
|
|
937
|
-
return _react["default"].createElement(_MenuItem["default"], {
|
|
938
|
-
key: index,
|
|
939
|
-
value: c.value
|
|
940
|
-
}, c.label);
|
|
941
|
-
})), choices && choices.length > 0 && _react["default"].createElement("div", {
|
|
942
|
-
className: classes.rightContainer
|
|
943
|
-
}, maxLength && showMaxLength && _react["default"].createElement(_TextField["default"], {
|
|
944
|
-
className: classes.lengthField,
|
|
945
|
-
label: "Maximum length (characters)",
|
|
946
|
-
type: "number",
|
|
947
|
-
inputProps: {
|
|
948
|
-
min: minLength,
|
|
949
|
-
max: minLength + 10
|
|
950
|
-
},
|
|
951
|
-
value: maxLength,
|
|
952
|
-
onChange: this.changeLength
|
|
953
|
-
}), _react["default"].createElement(_Button["default"], {
|
|
954
|
-
className: classes.addButton,
|
|
955
|
-
variant: "contained",
|
|
956
|
-
color: "primary",
|
|
957
|
-
onClick: this.onAddChoice
|
|
958
|
-
}, "Add"))), errors && errors[0] && _react["default"].createElement("div", {
|
|
959
|
-
className: classes.errorText
|
|
960
|
-
}, errors[0]), _react["default"].createElement("div", {
|
|
961
|
-
className: classes.altChoices
|
|
962
|
-
}, choices && choices.map(function (c, index) {
|
|
963
|
-
return index > 0 && _react["default"].createElement(Choice, {
|
|
964
|
-
key: index,
|
|
965
|
-
classes: classes,
|
|
966
|
-
markup: c.label,
|
|
967
|
-
onChange: function onChange(val) {
|
|
968
|
-
return _this3.onChoiceChanged(c, val, index);
|
|
969
|
-
},
|
|
970
|
-
onDelete: function onDelete() {
|
|
971
|
-
return _this3.onRemoveChoice(c);
|
|
972
|
-
},
|
|
973
|
-
spellCheck: spellCheck,
|
|
974
|
-
error: errors && errors[index]
|
|
975
|
-
});
|
|
976
|
-
})));
|
|
977
|
-
}
|
|
978
|
-
}]);
|
|
979
|
-
return AlternateSection;
|
|
980
|
-
})(_react["default"].Component);
|
|
981
|
-
exports.AlternateSection = AlternateSection;
|
|
982
|
-
(0, _defineProperty2["default"])(AlternateSection, "propTypes", {
|
|
983
|
-
choices: _propTypes["default"].array,
|
|
984
|
-
selectChoices: _propTypes["default"].array.isRequired,
|
|
985
|
-
classes: _propTypes["default"].object.isRequired,
|
|
986
|
-
onSelect: _propTypes["default"].func.isRequired,
|
|
987
|
-
choiceChanged: _propTypes["default"].func.isRequired,
|
|
988
|
-
lengthChanged: _propTypes["default"].func,
|
|
989
|
-
choiceRemoved: _propTypes["default"].func.isRequired,
|
|
990
|
-
value: _propTypes["default"].string,
|
|
991
|
-
maxLength: _propTypes["default"].number,
|
|
992
|
-
showMaxLength: _propTypes["default"].bool
|
|
993
|
-
});
|
|
994
|
-
var Styled = (0, _styles.withStyles)(styles)(AlternateSection);
|
|
995
|
-
var _default = Styled;
|
|
996
|
-
exports["default"] = _default;
|
|
997
|
-
})(alternateSection);
|
|
998
|
-
getDefaultExportFromCjs(alternateSection);
|
|
999
|
-
const require$$9$1 = _dll_react;
|
|
1000
|
-
const require$$10$2 = _dll_prop_types;
|
|
1001
|
-
const {isEqual: require$$11$2} = _dll_lodash;
|
|
1002
|
-
const {map: require$$12$2} = _dll_lodash;
|
|
1003
|
-
const {reduce: require$$13$2} = _dll_lodash;
|
|
1004
|
-
const {cloneDeep: require$$14$1} = _dll_lodash;
|
|
1005
|
-
(function (exports) {
|
|
1006
|
-
var _interopRequireDefault = interopRequireDefault.exports;
|
|
1007
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1008
|
-
value: true
|
|
1009
|
-
});
|
|
1010
|
-
exports["default"] = exports.AlternateResponses = void 0;
|
|
1011
|
-
var _toConsumableArray2 = _interopRequireDefault(toConsumableArray.exports);
|
|
1012
|
-
var _classCallCheck2 = _interopRequireDefault(classCallCheck.exports);
|
|
1013
|
-
var _createClass2 = _interopRequireDefault(createClass.exports);
|
|
1014
|
-
var _assertThisInitialized2 = _interopRequireDefault(assertThisInitialized.exports);
|
|
1015
|
-
var _inherits2 = _interopRequireDefault(inherits.exports);
|
|
1016
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(possibleConstructorReturn.exports);
|
|
1017
|
-
var _getPrototypeOf2 = _interopRequireDefault(getPrototypeOf.exports);
|
|
1018
|
-
var _defineProperty2 = _interopRequireDefault(defineProperty.exports);
|
|
1019
|
-
var _react = _interopRequireDefault(require$$9$1);
|
|
1020
|
-
var _propTypes = _interopRequireDefault(require$$10$2);
|
|
1021
|
-
var _isEqual = _interopRequireDefault(require$$11$2);
|
|
1022
|
-
var _map = _interopRequireDefault(require$$12$2);
|
|
1023
|
-
var _reduce = _interopRequireDefault(require$$13$2);
|
|
1024
|
-
var _cloneDeep = _interopRequireDefault(require$$14$1);
|
|
1025
|
-
var _alternateSection = _interopRequireDefault(alternateSection);
|
|
1026
|
-
function ownKeys(object, enumerableOnly) {
|
|
1027
|
-
var keys = Object.keys(object);
|
|
1028
|
-
if (Object.getOwnPropertySymbols) {
|
|
1029
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
1030
|
-
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
1031
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1032
|
-
})), keys.push.apply(keys, symbols));
|
|
1033
|
-
}
|
|
1034
|
-
return keys;
|
|
1035
|
-
}
|
|
1036
|
-
function _objectSpread(target) {
|
|
1037
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1038
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
1039
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
1040
|
-
(0, _defineProperty2["default"])(target, key, source[key]);
|
|
1041
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
1042
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
return target;
|
|
1046
|
-
}
|
|
1047
|
-
function _createSuper(Derived) {
|
|
1048
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
1049
|
-
return function _createSuperInternal() {
|
|
1050
|
-
var Super = (0, _getPrototypeOf2["default"])(Derived), result;
|
|
1051
|
-
if (hasNativeReflectConstruct) {
|
|
1052
|
-
var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
|
|
1053
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
1054
|
-
} else {
|
|
1055
|
-
result = Super.apply(this, arguments);
|
|
1056
|
-
}
|
|
1057
|
-
return (0, _possibleConstructorReturn2["default"])(this, result);
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
function _isNativeReflectConstruct() {
|
|
1061
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1062
|
-
if (Reflect.construct.sham) return false;
|
|
1063
|
-
if (typeof Proxy === "function") return true;
|
|
1064
|
-
try {
|
|
1065
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
1066
|
-
return true;
|
|
1067
|
-
} catch (e) {
|
|
1068
|
-
return false;
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
var AlternateResponses = (function (_React$Component) {
|
|
1072
|
-
(0, _inherits2["default"])(AlternateResponses, _React$Component);
|
|
1073
|
-
var _super = _createSuper(AlternateResponses);
|
|
1074
|
-
function AlternateResponses() {
|
|
1075
|
-
var _this;
|
|
1076
|
-
(0, _classCallCheck2["default"])(this, AlternateResponses);
|
|
1077
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1078
|
-
args[_key] = arguments[_key];
|
|
1079
|
-
}
|
|
1080
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
1081
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
1082
|
-
maxLengthPerChoice: (0, _cloneDeep["default"])(_this.props.model.maxLengthPerChoice)
|
|
1083
|
-
});
|
|
1084
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateChoicesIfNeeded", function (props) {
|
|
1085
|
-
if (!_this.state.choices || !(0, _isEqual["default"])(_this.state.choices, props.model.choices) || !(0, _isEqual["default"])(props.model.choices, _this.props.model.choices) || _this.state.values && Object.keys(_this.state.values).length !== Object.keys(_this.props.model.choices).length || props.maxLengthPerChoiceEnabled !== _this.props.maxLengthPerChoiceEnabled) {
|
|
1086
|
-
var _props$model = props.model, choices = _props$model.choices, maxLengthPerChoice = _props$model.maxLengthPerChoice;
|
|
1087
|
-
var selectedValues = (0, _reduce["default"])(choices, function (obj, c, key) {
|
|
1088
|
-
if (c && (props.maxLengthPerChoiceEnabled || c.length > 1)) {
|
|
1089
|
-
obj[key] = c[0];
|
|
1090
|
-
}
|
|
1091
|
-
return obj;
|
|
1092
|
-
}, {});
|
|
1093
|
-
_this.setState({
|
|
1094
|
-
choices: props.model.choices,
|
|
1095
|
-
values: selectedValues,
|
|
1096
|
-
maxLengthPerChoice: (0, _cloneDeep["default"])(maxLengthPerChoice)
|
|
1097
|
-
});
|
|
1098
|
-
}
|
|
1099
|
-
});
|
|
1100
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getRemainingChoices", function (valueKey) {
|
|
1101
|
-
var choices = _this.state.choices;
|
|
1102
|
-
return (0, _reduce["default"])(choices, function (arr, c, key) {
|
|
1103
|
-
if (c && c.length === 1 && !valueKey) {
|
|
1104
|
-
arr.push({
|
|
1105
|
-
label: c[0].label,
|
|
1106
|
-
value: key
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
return arr;
|
|
1110
|
-
}, []);
|
|
1111
|
-
});
|
|
1112
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChoiceChanged", function (choice, key) {
|
|
1113
|
-
var onChange = _this.props.onChange;
|
|
1114
|
-
var choices = _this.state.choices;
|
|
1115
|
-
var sectionChoices = choices[key] || [];
|
|
1116
|
-
var isNew = !sectionChoices.find(function (c) {
|
|
1117
|
-
return c.value === choice.value;
|
|
1118
|
-
});
|
|
1119
|
-
var newChoices = sectionChoices.reduce(function (arr, c) {
|
|
1120
|
-
var newVal = c.value === choice.value ? choice : c;
|
|
1121
|
-
arr.push(newVal);
|
|
1122
|
-
return arr;
|
|
1123
|
-
}, []);
|
|
1124
|
-
if (isNew) {
|
|
1125
|
-
newChoices.push(choice);
|
|
1126
|
-
}
|
|
1127
|
-
onChange(_objectSpread(_objectSpread({}, choices), {}, (0, _defineProperty2["default"])({}, key, newChoices)));
|
|
1128
|
-
});
|
|
1129
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChoiceRemoved", function (value, section) {
|
|
1130
|
-
var onChange = _this.props.onChange;
|
|
1131
|
-
var choices = _this.state.choices;
|
|
1132
|
-
var sectionChoices = choices[section] || [];
|
|
1133
|
-
var newChoices = sectionChoices.reduce(function (arr, c) {
|
|
1134
|
-
if (c.value === value) {
|
|
1135
|
-
return arr;
|
|
1136
|
-
}
|
|
1137
|
-
arr.push(c);
|
|
1138
|
-
return arr;
|
|
1139
|
-
}, []);
|
|
1140
|
-
onChange(_objectSpread(_objectSpread({}, choices), {}, (0, _defineProperty2["default"])({}, section, newChoices)));
|
|
1141
|
-
});
|
|
1142
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSectionSelect", function (choice, key) {
|
|
1143
|
-
var onChange = _this.props.onChange;
|
|
1144
|
-
var _this$state = _this.state, choices = _this$state.choices, values = _this$state.values;
|
|
1145
|
-
if (choices[key] && choices[key].length > 1) {
|
|
1146
|
-
if (!choice) {
|
|
1147
|
-
onChange(_objectSpread(_objectSpread({}, choices), {}, (0, _defineProperty2["default"])({}, key, [choices[key][0]])));
|
|
1148
|
-
}
|
|
1149
|
-
} else {
|
|
1150
|
-
_this.setState({
|
|
1151
|
-
choices: _objectSpread(_objectSpread({}, choices), {}, (0, _defineProperty2["default"])({}, key, [].concat((0, _toConsumableArray2["default"])(choices[key]), [{
|
|
1152
|
-
label: '',
|
|
1153
|
-
value: '1'
|
|
1154
|
-
}]))),
|
|
1155
|
-
values: _objectSpread(_objectSpread({}, values), {}, (0, _defineProperty2["default"])({}, key, choices[key][0]))
|
|
1156
|
-
});
|
|
1157
|
-
}
|
|
1158
|
-
});
|
|
1159
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onLengthChanged", function (value, key) {
|
|
1160
|
-
var _this$props = _this.props, model = _this$props.model, onLengthChange = _this$props.onLengthChange;
|
|
1161
|
-
var maxLengthPerChoice = model.maxLengthPerChoice;
|
|
1162
|
-
maxLengthPerChoice[key] = value;
|
|
1163
|
-
onLengthChange(maxLengthPerChoice);
|
|
1164
|
-
});
|
|
1165
|
-
return _this;
|
|
1166
|
-
}
|
|
1167
|
-
(0, _createClass2["default"])(AlternateResponses, [{
|
|
1168
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
1169
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
1170
|
-
this.updateChoicesIfNeeded(nextProps);
|
|
1171
|
-
}
|
|
1172
|
-
}, {
|
|
1173
|
-
key: "componentDidMount",
|
|
1174
|
-
value: function componentDidMount() {
|
|
1175
|
-
this.updateChoicesIfNeeded(this.props);
|
|
1176
|
-
}
|
|
1177
|
-
}, {
|
|
1178
|
-
key: "render",
|
|
1179
|
-
value: function render() {
|
|
1180
|
-
var _this2 = this;
|
|
1181
|
-
var choices = this.state.choices;
|
|
1182
|
-
var _this$props2 = this.props, _this$props2$model = _this$props2.model, maxLengthPerChoice = _this$props2$model.maxLengthPerChoice, maxLengthPerChoiceEnabled = _this$props2$model.maxLengthPerChoiceEnabled, spellCheck = _this$props2.spellCheck, choicesErrors = _this$props2.choicesErrors;
|
|
1183
|
-
return _react["default"].createElement("div", null, (0, _map["default"])(choices, function (c, key) {
|
|
1184
|
-
if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {
|
|
1185
|
-
var selected = _this2.state.values[key];
|
|
1186
|
-
return _react["default"].createElement(_alternateSection["default"], {
|
|
1187
|
-
key: key,
|
|
1188
|
-
value: selected && selected.value,
|
|
1189
|
-
errors: choicesErrors && choicesErrors[key],
|
|
1190
|
-
onSelect: function onSelect(choice) {
|
|
1191
|
-
return _this2.onSectionSelect(choice, key);
|
|
1192
|
-
},
|
|
1193
|
-
choiceChanged: function choiceChanged(choice) {
|
|
1194
|
-
return _this2.onChoiceChanged(choice, key);
|
|
1195
|
-
},
|
|
1196
|
-
choiceRemoved: function choiceRemoved(value) {
|
|
1197
|
-
return _this2.onChoiceRemoved(value, key);
|
|
1198
|
-
},
|
|
1199
|
-
lengthChanged: function lengthChanged(value) {
|
|
1200
|
-
return _this2.onLengthChanged(value, key);
|
|
1201
|
-
},
|
|
1202
|
-
selectChoices: [selected],
|
|
1203
|
-
choices: c,
|
|
1204
|
-
maxLength: maxLengthPerChoice[key],
|
|
1205
|
-
showMaxLength: maxLengthPerChoiceEnabled,
|
|
1206
|
-
spellCheck: spellCheck
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
}), choices && Object.keys(this.state.values).length !== Object.keys(choices).length && _react["default"].createElement(_alternateSection["default"], {
|
|
1210
|
-
value: "",
|
|
1211
|
-
onSelect: function onSelect(choice) {
|
|
1212
|
-
return _this2.onSectionSelect(choice, choice.value);
|
|
1213
|
-
},
|
|
1214
|
-
choiceChanged: function choiceChanged(choice) {
|
|
1215
|
-
return _this2.onChoiceChanged(choice);
|
|
1216
|
-
},
|
|
1217
|
-
choiceRemoved: function choiceRemoved(value) {
|
|
1218
|
-
return _this2.onChoiceRemoved(value);
|
|
1219
|
-
},
|
|
1220
|
-
selectChoices: this.getRemainingChoices(),
|
|
1221
|
-
spellCheck: spellCheck
|
|
1222
|
-
}));
|
|
1223
|
-
}
|
|
1224
|
-
}]);
|
|
1225
|
-
return AlternateResponses;
|
|
1226
|
-
})(_react["default"].Component);
|
|
1227
|
-
exports.AlternateResponses = AlternateResponses;
|
|
1228
|
-
(0, _defineProperty2["default"])(AlternateResponses, "propTypes", {
|
|
1229
|
-
model: _propTypes["default"].object.isRequired,
|
|
1230
|
-
onChange: _propTypes["default"].func.isRequired,
|
|
1231
|
-
onLengthChange: _propTypes["default"].func.isRequired,
|
|
1232
|
-
maxLengthPerChoiceEnabled: _propTypes["default"].bool.isRequired
|
|
1233
|
-
});
|
|
1234
|
-
var _default = AlternateResponses;
|
|
1235
|
-
exports["default"] = _default;
|
|
1236
|
-
})(alternateResponses);
|
|
1237
|
-
getDefaultExportFromCjs(alternateResponses);
|
|
1238
|
-
var utils = {};
|
|
1239
|
-
Object.defineProperty(utils, "__esModule", {
|
|
1240
|
-
value: true
|
|
1241
|
-
});
|
|
1242
|
-
utils.generateValidationMessage = void 0;
|
|
1243
|
-
var generateValidationMessage = function generateValidationMessage(config) {
|
|
1244
|
-
var maxResponseAreas = config.maxResponseAreas;
|
|
1245
|
-
var responseAreasMessage = '\nThe response area content should ' + 'not be empty and should be unique.\nThere should be at least 1 ' + (maxResponseAreas ? ("and at most ").concat(maxResponseAreas, " ") : '') + 'response area' + (maxResponseAreas ? 's' : '') + ' defined.';
|
|
1246
|
-
return 'Validation requirements:' + responseAreasMessage;
|
|
1247
|
-
};
|
|
1248
|
-
utils.generateValidationMessage = generateValidationMessage;
|
|
1249
|
-
const require$$10$1 = _dll_react;
|
|
1250
|
-
const require$$11$1 = _dll_prop_types;
|
|
1251
|
-
const {cloneDeep: require$$12$1} = _dll_lodash;
|
|
1252
|
-
const {isEmpty: require$$13$1} = _dll_lodash;
|
|
1253
|
-
const {pick: require$$14} = _dll_lodash;
|
|
1254
|
-
const {throttle: require$$15} = _dll_lodash;
|
|
1255
|
-
const require$$18 = _dll_material_ui__core_styles;
|
|
1256
|
-
const {Typography: require$$19} = _dll_material_ui__core;
|
|
1257
|
-
const {Tooltip: require$$21} = _dll_material_ui__core;
|
|
1258
|
-
const {Info: require$$20} = _dll_material_ui__icons;
|
|
1259
|
-
const require$$16 = _dll_pie_lib__editable_html;
|
|
1260
|
-
const require$$17 = _dll_pie_lib__config_ui;
|
|
1261
|
-
(function (exports) {
|
|
1262
|
-
var _interopRequireDefault = interopRequireDefault.exports;
|
|
1263
|
-
var _typeof$1 = _typeof.exports;
|
|
1264
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1265
|
-
value: true
|
|
1266
|
-
});
|
|
1267
|
-
exports["default"] = exports.Main = void 0;
|
|
1268
|
-
var _toConsumableArray2 = _interopRequireDefault(toConsumableArray.exports);
|
|
1269
|
-
var _classCallCheck2 = _interopRequireDefault(classCallCheck.exports);
|
|
1270
|
-
var _createClass2 = _interopRequireDefault(createClass.exports);
|
|
1271
|
-
var _assertThisInitialized2 = _interopRequireDefault(assertThisInitialized.exports);
|
|
1272
|
-
var _inherits2 = _interopRequireDefault(inherits.exports);
|
|
1273
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(possibleConstructorReturn.exports);
|
|
1274
|
-
var _getPrototypeOf2 = _interopRequireDefault(getPrototypeOf.exports);
|
|
1275
|
-
var _defineProperty2 = _interopRequireDefault(defineProperty.exports);
|
|
1276
|
-
var _react = _interopRequireDefault(require$$10$1);
|
|
1277
|
-
var _propTypes = _interopRequireDefault(require$$11$1);
|
|
1278
|
-
var _cloneDeep = _interopRequireDefault(require$$12$1);
|
|
1279
|
-
var _isEmpty = _interopRequireDefault(require$$13$1);
|
|
1280
|
-
var _pick = _interopRequireDefault(require$$14);
|
|
1281
|
-
var _throttle = _interopRequireDefault(require$$15);
|
|
1282
|
-
var _editableHtml = _interopRequireWildcard(require$$16);
|
|
1283
|
-
var _configUi = require$$17;
|
|
1284
|
-
var _styles = require$$18;
|
|
1285
|
-
var _Typography = _interopRequireDefault(require$$19);
|
|
1286
|
-
var _Info = _interopRequireDefault(require$$20);
|
|
1287
|
-
var _Tooltip = _interopRequireDefault(require$$21);
|
|
1288
|
-
var _ecrToolbar = _interopRequireDefault(ecrToolbar);
|
|
1289
|
-
var _alternateResponses = _interopRequireDefault(alternateResponses);
|
|
1290
|
-
var _markupUtils = markupUtils;
|
|
1291
|
-
var _utils = utils;
|
|
1292
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
1293
|
-
if (typeof WeakMap !== "function") return null;
|
|
1294
|
-
var cacheBabelInterop = new WeakMap();
|
|
1295
|
-
var cacheNodeInterop = new WeakMap();
|
|
1296
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
|
|
1297
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
1298
|
-
})(nodeInterop);
|
|
1299
|
-
}
|
|
1300
|
-
function _interopRequireWildcard(obj, nodeInterop) {
|
|
1301
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
1302
|
-
return obj;
|
|
1303
|
-
}
|
|
1304
|
-
if (obj === null || _typeof$1(obj) !== "object" && typeof obj !== "function") {
|
|
1305
|
-
return {
|
|
1306
|
-
"default": obj
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
1310
|
-
if (cache && cache.has(obj)) {
|
|
1311
|
-
return cache.get(obj);
|
|
1312
|
-
}
|
|
1313
|
-
var newObj = {};
|
|
1314
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
1315
|
-
for (var key in obj) {
|
|
1316
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
1317
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
1318
|
-
if (desc && (desc.get || desc.set)) {
|
|
1319
|
-
Object.defineProperty(newObj, key, desc);
|
|
1320
|
-
} else {
|
|
1321
|
-
newObj[key] = obj[key];
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
newObj["default"] = obj;
|
|
1326
|
-
if (cache) {
|
|
1327
|
-
cache.set(obj, newObj);
|
|
1328
|
-
}
|
|
1329
|
-
return newObj;
|
|
1330
|
-
}
|
|
1331
|
-
function ownKeys(object, enumerableOnly) {
|
|
1332
|
-
var keys = Object.keys(object);
|
|
1333
|
-
if (Object.getOwnPropertySymbols) {
|
|
1334
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
1335
|
-
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
1336
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1337
|
-
})), keys.push.apply(keys, symbols));
|
|
1338
|
-
}
|
|
1339
|
-
return keys;
|
|
1340
|
-
}
|
|
1341
|
-
function _objectSpread(target) {
|
|
1342
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1343
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
1344
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
1345
|
-
(0, _defineProperty2["default"])(target, key, source[key]);
|
|
1346
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
1347
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1348
|
-
});
|
|
1349
|
-
}
|
|
1350
|
-
return target;
|
|
1351
|
-
}
|
|
1352
|
-
function _createSuper(Derived) {
|
|
1353
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
1354
|
-
return function _createSuperInternal() {
|
|
1355
|
-
var Super = (0, _getPrototypeOf2["default"])(Derived), result;
|
|
1356
|
-
if (hasNativeReflectConstruct) {
|
|
1357
|
-
var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
|
|
1358
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
1359
|
-
} else {
|
|
1360
|
-
result = Super.apply(this, arguments);
|
|
1361
|
-
}
|
|
1362
|
-
return (0, _possibleConstructorReturn2["default"])(this, result);
|
|
1363
|
-
};
|
|
1364
|
-
}
|
|
1365
|
-
function _isNativeReflectConstruct() {
|
|
1366
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1367
|
-
if (Reflect.construct.sham) return false;
|
|
1368
|
-
if (typeof Proxy === "function") return true;
|
|
1369
|
-
try {
|
|
1370
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
1371
|
-
return true;
|
|
1372
|
-
} catch (e) {
|
|
1373
|
-
return false;
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
|
-
var toggle = _configUi.settings.toggle, Panel = _configUi.settings.Panel;
|
|
1377
|
-
var styles = function styles(theme) {
|
|
1378
|
-
return {
|
|
1379
|
-
promptHolder: {
|
|
1380
|
-
width: '100%',
|
|
1381
|
-
paddingBottom: theme.spacing.unit * 2,
|
|
1382
|
-
marginBottom: theme.spacing.unit * 2
|
|
1383
|
-
},
|
|
1384
|
-
prompt: {
|
|
1385
|
-
paddingTop: theme.spacing.unit * 2,
|
|
1386
|
-
width: '100%'
|
|
1387
|
-
},
|
|
1388
|
-
markup: {
|
|
1389
|
-
minHeight: '100px',
|
|
1390
|
-
paddingTop: theme.spacing.unit * 2,
|
|
1391
|
-
width: '100%',
|
|
1392
|
-
'& [data-slate-editor="true"]': {
|
|
1393
|
-
minHeight: '100px'
|
|
1394
|
-
}
|
|
1395
|
-
},
|
|
1396
|
-
design: {
|
|
1397
|
-
paddingTop: theme.spacing.unit * 3
|
|
1398
|
-
},
|
|
1399
|
-
choiceConfiguration: {
|
|
1400
|
-
paddingTop: theme.spacing.unit * 2,
|
|
1401
|
-
paddingBottom: theme.spacing.unit * 2
|
|
1402
|
-
},
|
|
1403
|
-
switchElement: {
|
|
1404
|
-
justifyContent: 'space-between',
|
|
1405
|
-
margin: 0
|
|
1406
|
-
},
|
|
1407
|
-
addButton: {
|
|
1408
|
-
"float": 'right'
|
|
1409
|
-
},
|
|
1410
|
-
text: {
|
|
1411
|
-
color: '#495B8F',
|
|
1412
|
-
fontFamily: 'Cerebri Sans',
|
|
1413
|
-
fontSize: '16px',
|
|
1414
|
-
lineHeight: '19px',
|
|
1415
|
-
marginTop: theme.spacing.unit * 4
|
|
1416
|
-
},
|
|
1417
|
-
tooltip: {
|
|
1418
|
-
fontSize: '12px',
|
|
1419
|
-
whiteSpace: 'pre',
|
|
1420
|
-
maxWidth: '500px'
|
|
1421
|
-
},
|
|
1422
|
-
errorText: {
|
|
1423
|
-
fontSize: '12px',
|
|
1424
|
-
color: 'red',
|
|
1425
|
-
padding: '5px 0'
|
|
1426
|
-
},
|
|
1427
|
-
flexContainer: {
|
|
1428
|
-
display: 'flex',
|
|
1429
|
-
alignItems: 'end'
|
|
1430
|
-
}
|
|
1431
|
-
};
|
|
1432
|
-
};
|
|
1433
|
-
var createElementFromHTML = function createElementFromHTML(htmlString) {
|
|
1434
|
-
var div = document.createElement('div');
|
|
1435
|
-
div.innerHTML = htmlString.trim();
|
|
1436
|
-
return div;
|
|
1437
|
-
};
|
|
1438
|
-
var Main = (function (_React$Component) {
|
|
1439
|
-
(0, _inherits2["default"])(Main, _React$Component);
|
|
1440
|
-
var _super = _createSuper(Main);
|
|
1441
|
-
function Main() {
|
|
1442
|
-
var _this;
|
|
1443
|
-
(0, _classCallCheck2["default"])(this, Main);
|
|
1444
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1445
|
-
args[_key] = arguments[_key];
|
|
1446
|
-
}
|
|
1447
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
1448
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {});
|
|
1449
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onModelChange", function (newVal) {
|
|
1450
|
-
_this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), newVal));
|
|
1451
|
-
});
|
|
1452
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPromptChanged", function (prompt) {
|
|
1453
|
-
_this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
1454
|
-
prompt: prompt
|
|
1455
|
-
}));
|
|
1456
|
-
});
|
|
1457
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRationaleChanged", function (rationale) {
|
|
1458
|
-
_this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
1459
|
-
rationale: rationale
|
|
1460
|
-
}));
|
|
1461
|
-
});
|
|
1462
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTeacherInstructionsChanged", function (teacherInstructions) {
|
|
1463
|
-
var _this$props = _this.props, model = _this$props.model, onModelChanged = _this$props.onModelChanged;
|
|
1464
|
-
onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
|
|
1465
|
-
teacherInstructions: teacherInstructions
|
|
1466
|
-
}));
|
|
1467
|
-
});
|
|
1468
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onMarkupChanged", function (slateMarkup) {
|
|
1469
|
-
_this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
1470
|
-
slateMarkup: slateMarkup
|
|
1471
|
-
}));
|
|
1472
|
-
});
|
|
1473
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onResponsesChanged", function (choices) {
|
|
1474
|
-
_this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
1475
|
-
choices: choices
|
|
1476
|
-
}));
|
|
1477
|
-
});
|
|
1478
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onLengthChanged", function (maxLengthPerChoice) {
|
|
1479
|
-
var _this$props2 = _this.props, model = _this$props2.model, onModelChanged = _this$props2.onModelChanged;
|
|
1480
|
-
onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
|
|
1481
|
-
maxLengthPerChoice: maxLengthPerChoice
|
|
1482
|
-
}));
|
|
1483
|
-
});
|
|
1484
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChangeResponse", function (index, newVal) {
|
|
1485
|
-
var _this$props3 = _this.props, model = _this$props3.model, onModelChanged = _this$props3.onModelChanged;
|
|
1486
|
-
var choices = model.choices;
|
|
1487
|
-
var maxLengthPerChoice = model.maxLengthPerChoice;
|
|
1488
|
-
var newValLength = (newVal || '').length;
|
|
1489
|
-
if (!choices[index]) {
|
|
1490
|
-
choices[index] = [{
|
|
1491
|
-
label: newVal || '',
|
|
1492
|
-
value: '0'
|
|
1493
|
-
}];
|
|
1494
|
-
var nbOfMissingChoices = index > maxLengthPerChoice.length ? index - maxLengthPerChoice.length : 0;
|
|
1495
|
-
maxLengthPerChoice = [].concat((0, _toConsumableArray2["default"])(maxLengthPerChoice), (0, _toConsumableArray2["default"])(Array(nbOfMissingChoices).fill(1)));
|
|
1496
|
-
maxLengthPerChoice.splice(index, 0, (0, _markupUtils.getAdjustedLength)(newValLength));
|
|
1497
|
-
} else {
|
|
1498
|
-
choices[index][0].label = newVal || '';
|
|
1499
|
-
if (maxLengthPerChoice && (maxLengthPerChoice[index] < newValLength || maxLengthPerChoice[index] > newValLength + 10)) {
|
|
1500
|
-
maxLengthPerChoice[index] = (0, _markupUtils.getAdjustedLength)(newValLength);
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
|
|
1504
|
-
choices: choices,
|
|
1505
|
-
maxLengthPerChoice: maxLengthPerChoice
|
|
1506
|
-
}));
|
|
1507
|
-
});
|
|
1508
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (markup) {
|
|
1509
|
-
var _this$props4 = _this.props, _this$props4$model = _this$props4.model, choices = _this$props4$model.choices, maxLengthPerChoice = _this$props4$model.maxLengthPerChoice, onModelChanged = _this$props4.onModelChanged;
|
|
1510
|
-
var domMarkup = createElementFromHTML(markup);
|
|
1511
|
-
var allRespAreas = domMarkup.querySelectorAll('[data-type="explicit_constructed_response"]');
|
|
1512
|
-
var allChoices = {};
|
|
1513
|
-
var updatedMaxLengthPerChoice = [];
|
|
1514
|
-
allRespAreas.forEach(function (el, index) {
|
|
1515
|
-
var newChoices = (0, _cloneDeep["default"])(choices[el.dataset.index]);
|
|
1516
|
-
if (newChoices) {
|
|
1517
|
-
newChoices[0] = {
|
|
1518
|
-
label: el.dataset.value || '',
|
|
1519
|
-
value: '0'
|
|
1520
|
-
};
|
|
1521
|
-
updatedMaxLengthPerChoice[index] = maxLengthPerChoice[el.dataset.index];
|
|
1522
|
-
}
|
|
1523
|
-
allChoices[index] = newChoices;
|
|
1524
|
-
el.dataset.index = index;
|
|
1525
|
-
});
|
|
1526
|
-
var callback = function callback() {
|
|
1527
|
-
return onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
1528
|
-
choices: allChoices,
|
|
1529
|
-
slateMarkup: domMarkup.innerHTML,
|
|
1530
|
-
maxLengthPerChoice: updatedMaxLengthPerChoice
|
|
1531
|
-
}));
|
|
1532
|
-
};
|
|
1533
|
-
_this.setState({
|
|
1534
|
-
cachedChoices: undefined
|
|
1535
|
-
}, callback);
|
|
1536
|
-
});
|
|
1537
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onHandleAreaChange", (0, _throttle["default"])(function (nodes) {
|
|
1538
|
-
var _this$props5 = _this.props, choices = _this$props5.model.choices, onModelChanged = _this$props5.onModelChanged;
|
|
1539
|
-
var cachedChoices = _this.state.cachedChoices;
|
|
1540
|
-
if (!nodes) {
|
|
1541
|
-
return;
|
|
1542
|
-
}
|
|
1543
|
-
var newChoices = choices ? (0, _cloneDeep["default"])(choices) : {};
|
|
1544
|
-
var newCachedChoices = cachedChoices ? (0, _cloneDeep["default"])(cachedChoices) : {};
|
|
1545
|
-
nodes.forEach(function (node) {
|
|
1546
|
-
var keyForNode = node.data.get('index');
|
|
1547
|
-
if (!newChoices[keyForNode] && newCachedChoices[keyForNode]) {
|
|
1548
|
-
Object.assign(newChoices, (0, _pick["default"])(newCachedChoices, keyForNode));
|
|
1549
|
-
if (newCachedChoices.hasOwnProperty(keyForNode)) {
|
|
1550
|
-
delete newCachedChoices[keyForNode];
|
|
1551
|
-
}
|
|
1552
|
-
} else {
|
|
1553
|
-
Object.assign(newCachedChoices, (0, _pick["default"])(newChoices, keyForNode));
|
|
1554
|
-
if (newChoices.hasOwnProperty(keyForNode)) {
|
|
1555
|
-
delete newChoices[keyForNode];
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
});
|
|
1559
|
-
var callback = function callback() {
|
|
1560
|
-
return onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
1561
|
-
choices: newChoices
|
|
1562
|
-
}));
|
|
1563
|
-
};
|
|
1564
|
-
_this.setState({
|
|
1565
|
-
cachedChoices: newCachedChoices
|
|
1566
|
-
}, callback);
|
|
1567
|
-
}, 500, {
|
|
1568
|
-
trailing: false,
|
|
1569
|
-
leading: true
|
|
1570
|
-
}));
|
|
1571
|
-
return _this;
|
|
1572
|
-
}
|
|
1573
|
-
(0, _createClass2["default"])(Main, [{
|
|
1574
|
-
key: "componentDidMount",
|
|
1575
|
-
value: function componentDidMount() {
|
|
1576
|
-
var _this$props6 = this.props, _this$props6$model = _this$props6.model, slateMarkup = _this$props6$model.slateMarkup, choices = _this$props6$model.choices, _this$props6$model$ma = _this$props6$model.maxLengthPerChoice, maxLengthPerChoice = _this$props6$model$ma === void 0 ? [] : _this$props6$model$ma, onModelChanged = _this$props6.onModelChanged;
|
|
1577
|
-
var undefinedLengths = !maxLengthPerChoice.length;
|
|
1578
|
-
this.setState({
|
|
1579
|
-
markup: slateMarkup
|
|
1580
|
-
});
|
|
1581
|
-
Object.values(choices).forEach(function (choice, index) {
|
|
1582
|
-
var labelLengthsArr = (choice || []).map(function (choice) {
|
|
1583
|
-
return (choice.label || '').length;
|
|
1584
|
-
});
|
|
1585
|
-
var length = Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr));
|
|
1586
|
-
if (undefinedLengths || !maxLengthPerChoice[index] || maxLengthPerChoice[index] < length || maxLengthPerChoice[index] > length + 10) {
|
|
1587
|
-
maxLengthPerChoice[index] = (0, _markupUtils.getAdjustedLength)(length);
|
|
1588
|
-
}
|
|
1589
|
-
});
|
|
1590
|
-
onModelChanged(_objectSpread(_objectSpread({}, this.props.model), {}, {
|
|
1591
|
-
maxLengthPerChoice: maxLengthPerChoice
|
|
1592
|
-
}));
|
|
1593
|
-
}
|
|
1594
|
-
}, {
|
|
1595
|
-
key: "render",
|
|
1596
|
-
value: function render() {
|
|
1597
|
-
var _this2 = this;
|
|
1598
|
-
var _this$props7 = this.props, classes = _this$props7.classes, model = _this$props7.model, configuration = _this$props7.configuration, onConfigurationChanged = _this$props7.onConfigurationChanged, imageSupport = _this$props7.imageSupport;
|
|
1599
|
-
var _ref = configuration || ({}), _ref$prompt = _ref.prompt, prompt = _ref$prompt === void 0 ? {} : _ref$prompt, _ref$partialScoring = _ref.partialScoring, partialScoring = _ref$partialScoring === void 0 ? {} : _ref$partialScoring, _ref$rationale = _ref.rationale, rationale = _ref$rationale === void 0 ? {} : _ref$rationale, _ref$teacherInstructi = _ref.teacherInstructions, teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi, _ref$maxLengthPerChoi = _ref.maxLengthPerChoice, maxLengthPerChoice = _ref$maxLengthPerChoi === void 0 ? {} : _ref$maxLengthPerChoi, _ref$spellCheck = _ref.spellCheck, spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck, _ref$playerSpellCheck = _ref.playerSpellCheck, playerSpellCheck = _ref$playerSpellCheck === void 0 ? {} : _ref$playerSpellCheck, maxResponseAreas = _ref.maxResponseAreas;
|
|
1600
|
-
var _ref2 = model || ({}), teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled, promptEnabled = _ref2.promptEnabled, rationaleEnabled = _ref2.rationaleEnabled, maxLengthPerChoiceEnabled = _ref2.maxLengthPerChoiceEnabled, spellCheckEnabled = _ref2.spellCheckEnabled, errors = _ref2.errors;
|
|
1601
|
-
var toolbarOpts = {};
|
|
1602
|
-
var _ref3 = errors || ({}), responseAreasError = _ref3.responseAreasError, _ref3$choicesErrors = _ref3.choicesErrors, choicesErrors = _ref3$choicesErrors === void 0 ? {} : _ref3$choicesErrors;
|
|
1603
|
-
var validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
1604
|
-
switch (model.toolbarEditorPosition) {
|
|
1605
|
-
case 'top':
|
|
1606
|
-
toolbarOpts.position = 'top';
|
|
1607
|
-
break;
|
|
1608
|
-
default:
|
|
1609
|
-
toolbarOpts.position = 'bottom';
|
|
1610
|
-
break;
|
|
1611
|
-
}
|
|
1612
|
-
return _react["default"].createElement("div", {
|
|
1613
|
-
className: classes.design
|
|
1614
|
-
}, _react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
1615
|
-
settings: _react["default"].createElement(Panel, {
|
|
1616
|
-
model: model,
|
|
1617
|
-
configuration: configuration,
|
|
1618
|
-
onChangeModel: function onChangeModel(model) {
|
|
1619
|
-
return _this2.onModelChange(model);
|
|
1620
|
-
},
|
|
1621
|
-
onChangeConfiguration: function onChangeConfiguration(configuration) {
|
|
1622
|
-
return onConfigurationChanged(configuration, true);
|
|
1623
|
-
},
|
|
1624
|
-
groups: {
|
|
1625
|
-
Settings: {
|
|
1626
|
-
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
1627
|
-
maxLengthPerChoiceEnabled: maxLengthPerChoice.settings && toggle(maxLengthPerChoice.label)
|
|
1628
|
-
},
|
|
1629
|
-
Properties: {
|
|
1630
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
1631
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
1632
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
1633
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
1634
|
-
playerSpellCheckEnabled: playerSpellCheck.settings && toggle(playerSpellCheck.label)
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
})
|
|
1638
|
-
}, _react["default"].createElement("div", null, teacherInstructionsEnabled && _react["default"].createElement(_configUi.InputContainer, {
|
|
1639
|
-
label: teacherInstructions.label,
|
|
1640
|
-
className: classes.promptHolder
|
|
1641
|
-
}, _react["default"].createElement(_editableHtml["default"], {
|
|
1642
|
-
className: classes.prompt,
|
|
1643
|
-
markup: model.teacherInstructions || '',
|
|
1644
|
-
onChange: this.onTeacherInstructionsChanged,
|
|
1645
|
-
imageSupport: imageSupport,
|
|
1646
|
-
nonEmpty: false,
|
|
1647
|
-
toolbarOpts: toolbarOpts,
|
|
1648
|
-
spellCheck: spellCheckEnabled
|
|
1649
|
-
})), promptEnabled && _react["default"].createElement(_configUi.InputContainer, {
|
|
1650
|
-
label: prompt.label,
|
|
1651
|
-
className: classes.promptHolder
|
|
1652
|
-
}, _react["default"].createElement(_editableHtml["default"], {
|
|
1653
|
-
className: classes.prompt,
|
|
1654
|
-
markup: model.prompt,
|
|
1655
|
-
onChange: this.onPromptChanged,
|
|
1656
|
-
imageSupport: imageSupport,
|
|
1657
|
-
nonEmpty: false,
|
|
1658
|
-
disableUnderline: true,
|
|
1659
|
-
toolbarOpts: toolbarOpts,
|
|
1660
|
-
spellCheck: spellCheckEnabled
|
|
1661
|
-
})), _react["default"].createElement("div", {
|
|
1662
|
-
className: classes.flexContainer
|
|
1663
|
-
}, _react["default"].createElement(_Typography["default"], {
|
|
1664
|
-
className: classes.text
|
|
1665
|
-
}, "Define Template, Choices, and Correct Responses"), _react["default"].createElement(_Tooltip["default"], {
|
|
1666
|
-
classes: {
|
|
1667
|
-
tooltip: classes.tooltip
|
|
1668
|
-
},
|
|
1669
|
-
disableFocusListener: true,
|
|
1670
|
-
disableTouchListener: true,
|
|
1671
|
-
placement: 'right',
|
|
1672
|
-
title: validationMessage
|
|
1673
|
-
}, _react["default"].createElement(_Info["default"], {
|
|
1674
|
-
fontSize: 'small',
|
|
1675
|
-
color: 'primary',
|
|
1676
|
-
style: {
|
|
1677
|
-
marginLeft: '5px'
|
|
1678
|
-
}
|
|
1679
|
-
}))), responseAreasError && _react["default"].createElement("div", {
|
|
1680
|
-
className: classes.errorText
|
|
1681
|
-
}, responseAreasError), _react["default"].createElement(_editableHtml["default"], {
|
|
1682
|
-
activePlugins: _editableHtml.ALL_PLUGINS,
|
|
1683
|
-
toolbarOpts: {
|
|
1684
|
-
position: 'top'
|
|
1685
|
-
},
|
|
1686
|
-
spellCheck: spellCheckEnabled,
|
|
1687
|
-
responseAreaProps: {
|
|
1688
|
-
type: 'explicit-constructed-response',
|
|
1689
|
-
options: {
|
|
1690
|
-
duplicates: true
|
|
1691
|
-
},
|
|
1692
|
-
maxResponseAreas: maxResponseAreas,
|
|
1693
|
-
respAreaToolbar: function respAreaToolbar(node, value, onToolbarDone) {
|
|
1694
|
-
var model = _this2.props.model;
|
|
1695
|
-
var correctChoice = (model.choices[node.data.get('index')] || [])[0];
|
|
1696
|
-
return function () {
|
|
1697
|
-
return _react["default"].createElement(_ecrToolbar["default"], {
|
|
1698
|
-
onChangeResponse: function onChangeResponse(newVal) {
|
|
1699
|
-
return _this2.onChangeResponse(node.data.get('index'), newVal);
|
|
1700
|
-
},
|
|
1701
|
-
node: node,
|
|
1702
|
-
value: value,
|
|
1703
|
-
onToolbarDone: onToolbarDone,
|
|
1704
|
-
correctChoice: correctChoice
|
|
1705
|
-
});
|
|
1706
|
-
};
|
|
1707
|
-
},
|
|
1708
|
-
error: function error() {
|
|
1709
|
-
return choicesErrors;
|
|
1710
|
-
},
|
|
1711
|
-
onHandleAreaChange: this.onHandleAreaChange
|
|
1712
|
-
},
|
|
1713
|
-
className: classes.markup,
|
|
1714
|
-
markup: model.slateMarkup,
|
|
1715
|
-
onChange: this.onChange,
|
|
1716
|
-
imageSupport: imageSupport,
|
|
1717
|
-
onBlur: this.onBlur,
|
|
1718
|
-
disabled: false,
|
|
1719
|
-
highlightShape: false,
|
|
1720
|
-
error: responseAreasError
|
|
1721
|
-
}), !(0, _isEmpty["default"])(model.choices) && _react["default"].createElement(_Typography["default"], {
|
|
1722
|
-
className: classes.text
|
|
1723
|
-
}, ("Define Alternates ").concat(maxLengthPerChoiceEnabled ? 'and Character Limits' : '')), _react["default"].createElement(_alternateResponses["default"], {
|
|
1724
|
-
model: model,
|
|
1725
|
-
onChange: this.onResponsesChanged,
|
|
1726
|
-
onLengthChange: this.onLengthChanged,
|
|
1727
|
-
maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled,
|
|
1728
|
-
spellCheck: spellCheckEnabled,
|
|
1729
|
-
choicesErrors: choicesErrors
|
|
1730
|
-
}), rationaleEnabled && _react["default"].createElement(_configUi.InputContainer, {
|
|
1731
|
-
label: rationale.label,
|
|
1732
|
-
className: classes.promptHolder
|
|
1733
|
-
}, _react["default"].createElement(_editableHtml["default"], {
|
|
1734
|
-
className: classes.prompt,
|
|
1735
|
-
markup: model.rationale || '',
|
|
1736
|
-
onChange: this.onRationaleChanged,
|
|
1737
|
-
imageSupport: imageSupport,
|
|
1738
|
-
toolbarOpts: toolbarOpts,
|
|
1739
|
-
spellCheck: spellCheckEnabled
|
|
1740
|
-
})))));
|
|
1741
|
-
}
|
|
1742
|
-
}]);
|
|
1743
|
-
return Main;
|
|
1744
|
-
})(_react["default"].Component);
|
|
1745
|
-
exports.Main = Main;
|
|
1746
|
-
(0, _defineProperty2["default"])(Main, "propTypes", {
|
|
1747
|
-
configuration: _propTypes["default"].object.isRequired,
|
|
1748
|
-
model: _propTypes["default"].object.isRequired,
|
|
1749
|
-
disableSidePanel: _propTypes["default"].bool,
|
|
1750
|
-
onModelChanged: _propTypes["default"].func.isRequired,
|
|
1751
|
-
onConfigurationChanged: _propTypes["default"].func.isRequired,
|
|
1752
|
-
classes: _propTypes["default"].object.isRequired,
|
|
1753
|
-
imageSupport: _propTypes["default"].shape({
|
|
1754
|
-
add: _propTypes["default"].func.isRequired,
|
|
1755
|
-
"delete": _propTypes["default"].func.isRequired
|
|
1756
|
-
})
|
|
1757
|
-
});
|
|
1758
|
-
var Styled = (0, _styles.withStyles)(styles)(Main);
|
|
1759
|
-
var _default = Styled;
|
|
1760
|
-
exports["default"] = _default;
|
|
1761
|
-
})(main);
|
|
1762
|
-
getDefaultExportFromCjs(main);
|
|
1763
|
-
var defaults = {};
|
|
1764
|
-
(function (exports) {
|
|
1765
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1766
|
-
value: true
|
|
1767
|
-
});
|
|
1768
|
-
exports["default"] = void 0;
|
|
1769
|
-
var _default = {
|
|
1770
|
-
model: {
|
|
1771
|
-
disabled: false,
|
|
1772
|
-
mode: 'gather',
|
|
1773
|
-
prompt: 'Use the inputs to complete the sentence',
|
|
1774
|
-
shuffle: true,
|
|
1775
|
-
markup: '<p>The {{0}} jumped {{1}} the {{2}}</p>',
|
|
1776
|
-
toolbarEditorPosition: 'bottom',
|
|
1777
|
-
displayType: 'block',
|
|
1778
|
-
spellCheckEnabled: true,
|
|
1779
|
-
playerSpellCheckEnabled: true,
|
|
1780
|
-
choices: {
|
|
1781
|
-
0: [{
|
|
1782
|
-
label: 'cow',
|
|
1783
|
-
value: '0'
|
|
1784
|
-
}, {
|
|
1785
|
-
label: 'cattle',
|
|
1786
|
-
value: '1'
|
|
1787
|
-
}, {
|
|
1788
|
-
label: 'calf',
|
|
1789
|
-
value: '2',
|
|
1790
|
-
correct: false
|
|
1791
|
-
}],
|
|
1792
|
-
1: [{
|
|
1793
|
-
label: 'over',
|
|
1794
|
-
value: '0'
|
|
1795
|
-
}, {
|
|
1796
|
-
label: 'past',
|
|
1797
|
-
value: '1'
|
|
1798
|
-
}, {
|
|
1799
|
-
label: 'beyond',
|
|
1800
|
-
value: '2'
|
|
1801
|
-
}],
|
|
1802
|
-
2: [{
|
|
1803
|
-
label: 'moon',
|
|
1804
|
-
value: '0'
|
|
1805
|
-
}, {
|
|
1806
|
-
label: 'satellite',
|
|
1807
|
-
value: '2'
|
|
1808
|
-
}, {
|
|
1809
|
-
label: 'house ',
|
|
1810
|
-
value: '3'
|
|
1811
|
-
}]
|
|
1812
|
-
},
|
|
1813
|
-
maxLengthPerChoiceEnabled: true,
|
|
1814
|
-
rationaleEnabled: true,
|
|
1815
|
-
promptEnabled: true,
|
|
1816
|
-
teacherInstructionsEnabled: true,
|
|
1817
|
-
studentInstructionsEnabled: true
|
|
1818
|
-
},
|
|
1819
|
-
configuration: {
|
|
1820
|
-
prompt: {
|
|
1821
|
-
settings: true,
|
|
1822
|
-
label: 'Prompt'
|
|
1823
|
-
},
|
|
1824
|
-
partialScoring: {
|
|
1825
|
-
settings: false,
|
|
1826
|
-
label: 'Allow Partial Scoring'
|
|
1827
|
-
},
|
|
1828
|
-
rationale: {
|
|
1829
|
-
settings: true,
|
|
1830
|
-
label: 'Rationale'
|
|
1831
|
-
},
|
|
1832
|
-
spellCheck: {
|
|
1833
|
-
label: 'Spellcheck',
|
|
1834
|
-
settings: false,
|
|
1835
|
-
enabled: true
|
|
1836
|
-
},
|
|
1837
|
-
playerSpellCheck: {
|
|
1838
|
-
label: 'Student Spellcheck',
|
|
1839
|
-
settings: true,
|
|
1840
|
-
enabled: true
|
|
1841
|
-
},
|
|
1842
|
-
teacherInstructions: {
|
|
1843
|
-
settings: true,
|
|
1844
|
-
label: 'Teacher Instructions'
|
|
1845
|
-
},
|
|
1846
|
-
maxLengthPerChoice: {
|
|
1847
|
-
settings: true,
|
|
1848
|
-
label: 'Maximum Length Per Choice'
|
|
1849
|
-
},
|
|
1850
|
-
maxResponseAreas: 10
|
|
1851
|
-
}
|
|
1852
|
-
};
|
|
1853
|
-
exports["default"] = _default;
|
|
1854
|
-
})(defaults);
|
|
1855
|
-
getDefaultExportFromCjs(defaults);
|
|
1856
|
-
const require$$9 = _dll_react;
|
|
1857
|
-
const require$$10 = _dll_react_dom;
|
|
1858
|
-
const require$$11 = _dll_debug;
|
|
1859
|
-
const {defaults: require$$12} = _dll_lodash;
|
|
1860
|
-
const {isArray: require$$13} = _dll_lodash;
|
|
1861
|
-
(function (exports) {
|
|
1862
|
-
var _interopRequireDefault = interopRequireDefault.exports;
|
|
1863
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1864
|
-
value: true
|
|
1865
|
-
});
|
|
1866
|
-
exports["default"] = void 0;
|
|
1867
|
-
var _classCallCheck2 = _interopRequireDefault(classCallCheck.exports);
|
|
1868
|
-
var _createClass2 = _interopRequireDefault(createClass.exports);
|
|
1869
|
-
var _assertThisInitialized2 = _interopRequireDefault(assertThisInitialized.exports);
|
|
1870
|
-
var _inherits2 = _interopRequireDefault(inherits.exports);
|
|
1871
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(possibleConstructorReturn.exports);
|
|
1872
|
-
var _getPrototypeOf2 = _interopRequireDefault(getPrototypeOf.exports);
|
|
1873
|
-
var _wrapNativeSuper2 = _interopRequireDefault(wrapNativeSuper.exports);
|
|
1874
|
-
var _defineProperty2 = _interopRequireDefault(defineProperty.exports);
|
|
1875
|
-
var _react = _interopRequireDefault(require$$9);
|
|
1876
|
-
var _reactDom = _interopRequireDefault(require$$10);
|
|
1877
|
-
var _debug = _interopRequireDefault(require$$11);
|
|
1878
|
-
var _defaults = _interopRequireDefault(require$$12);
|
|
1879
|
-
var _isArray = _interopRequireDefault(require$$13);
|
|
1880
|
-
var _pieConfigureEvents = lib;
|
|
1881
|
-
var _main = _interopRequireDefault(main);
|
|
1882
|
-
var _defaults2 = _interopRequireDefault(defaults);
|
|
1883
|
-
var _markupUtils = markupUtils;
|
|
1884
|
-
function ownKeys(object, enumerableOnly) {
|
|
1885
|
-
var keys = Object.keys(object);
|
|
1886
|
-
if (Object.getOwnPropertySymbols) {
|
|
1887
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
1888
|
-
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
1889
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1890
|
-
})), keys.push.apply(keys, symbols));
|
|
1891
|
-
}
|
|
1892
|
-
return keys;
|
|
1893
|
-
}
|
|
1894
|
-
function _objectSpread(target) {
|
|
1895
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1896
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
1897
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
1898
|
-
(0, _defineProperty2["default"])(target, key, source[key]);
|
|
1899
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
1900
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1901
|
-
});
|
|
1902
|
-
}
|
|
1903
|
-
return target;
|
|
1904
|
-
}
|
|
1905
|
-
function _createSuper(Derived) {
|
|
1906
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
1907
|
-
return function _createSuperInternal() {
|
|
1908
|
-
var Super = (0, _getPrototypeOf2["default"])(Derived), result;
|
|
1909
|
-
if (hasNativeReflectConstruct) {
|
|
1910
|
-
var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
|
|
1911
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
1912
|
-
} else {
|
|
1913
|
-
result = Super.apply(this, arguments);
|
|
1914
|
-
}
|
|
1915
|
-
return (0, _possibleConstructorReturn2["default"])(this, result);
|
|
1916
|
-
};
|
|
1917
|
-
}
|
|
1918
|
-
function _isNativeReflectConstruct() {
|
|
1919
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1920
|
-
if (Reflect.construct.sham) return false;
|
|
1921
|
-
if (typeof Proxy === "function") return true;
|
|
1922
|
-
try {
|
|
1923
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
1924
|
-
return true;
|
|
1925
|
-
} catch (e) {
|
|
1926
|
-
return false;
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
var log = (0, _debug["default"])('explicit-constructed-response:configure');
|
|
1930
|
-
var ExplicitConstructedResponse = (function (_HTMLElement) {
|
|
1931
|
-
(0, _inherits2["default"])(ExplicitConstructedResponse, _HTMLElement);
|
|
1932
|
-
var _super = _createSuper(ExplicitConstructedResponse);
|
|
1933
|
-
function ExplicitConstructedResponse() {
|
|
1934
|
-
var _this;
|
|
1935
|
-
(0, _classCallCheck2["default"])(this, ExplicitConstructedResponse);
|
|
1936
|
-
_this = _super.call(this);
|
|
1937
|
-
_this._model = ExplicitConstructedResponse.prepareModel();
|
|
1938
|
-
_this._configuration = _defaults2["default"].configuration;
|
|
1939
|
-
_this.onModelChanged = _this.onModelChanged.bind((0, _assertThisInitialized2["default"])(_this));
|
|
1940
|
-
_this.onConfigurationChanged = _this.onConfigurationChanged.bind((0, _assertThisInitialized2["default"])(_this));
|
|
1941
|
-
return _this;
|
|
1942
|
-
}
|
|
1943
|
-
(0, _createClass2["default"])(ExplicitConstructedResponse, [{
|
|
1944
|
-
key: "model",
|
|
1945
|
-
set: function set(s) {
|
|
1946
|
-
this._model = ExplicitConstructedResponse.prepareModel(s);
|
|
1947
|
-
this._render();
|
|
1948
|
-
}
|
|
1949
|
-
}, {
|
|
1950
|
-
key: "configuration",
|
|
1951
|
-
set: function set(c) {
|
|
1952
|
-
this._configuration = (0, _defaults["default"])(c, _defaults2["default"].configuration);
|
|
1953
|
-
this._render();
|
|
1954
|
-
}
|
|
1955
|
-
}, {
|
|
1956
|
-
key: "disableSidePanel",
|
|
1957
|
-
set: function set(s) {
|
|
1958
|
-
this._disableSidePanel = s;
|
|
1959
|
-
this._render();
|
|
1960
|
-
}
|
|
1961
|
-
}, {
|
|
1962
|
-
key: "dispatchModelUpdated",
|
|
1963
|
-
value: function dispatchModelUpdated(reset) {
|
|
1964
|
-
var resetValue = !!reset;
|
|
1965
|
-
this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model, resetValue));
|
|
1966
|
-
}
|
|
1967
|
-
}, {
|
|
1968
|
-
key: "onModelChanged",
|
|
1969
|
-
value: function onModelChanged(m, reset) {
|
|
1970
|
-
this._model = ExplicitConstructedResponse.prepareModel(m);
|
|
1971
|
-
this._render();
|
|
1972
|
-
this.dispatchModelUpdated(reset);
|
|
1973
|
-
}
|
|
1974
|
-
}, {
|
|
1975
|
-
key: "onConfigurationChanged",
|
|
1976
|
-
value: function onConfigurationChanged(c) {
|
|
1977
|
-
this._configuration = c;
|
|
1978
|
-
this._render();
|
|
1979
|
-
}
|
|
1980
|
-
}, {
|
|
1981
|
-
key: "insertImage",
|
|
1982
|
-
value: function insertImage(handler) {
|
|
1983
|
-
this.dispatchEvent(new _pieConfigureEvents.InsertImageEvent(handler));
|
|
1984
|
-
}
|
|
1985
|
-
}, {
|
|
1986
|
-
key: "onDeleteImage",
|
|
1987
|
-
value: function onDeleteImage(src, done) {
|
|
1988
|
-
this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
|
|
1989
|
-
}
|
|
1990
|
-
}, {
|
|
1991
|
-
key: "_render",
|
|
1992
|
-
value: function _render() {
|
|
1993
|
-
log('_render');
|
|
1994
|
-
var element = _react["default"].createElement(_main["default"], {
|
|
1995
|
-
model: this._model,
|
|
1996
|
-
configuration: this._configuration,
|
|
1997
|
-
onModelChanged: this.onModelChanged,
|
|
1998
|
-
onConfigurationChanged: this.onConfigurationChanged,
|
|
1999
|
-
disableSidePanel: this._disableSidePanel,
|
|
2000
|
-
imageSupport: {
|
|
2001
|
-
add: this.insertImage.bind(this),
|
|
2002
|
-
"delete": this.onDeleteImage.bind(this)
|
|
2003
|
-
}
|
|
2004
|
-
});
|
|
2005
|
-
_reactDom["default"].render(element, this);
|
|
2006
|
-
}
|
|
2007
|
-
}]);
|
|
2008
|
-
return ExplicitConstructedResponse;
|
|
2009
|
-
})((0, _wrapNativeSuper2["default"])(HTMLElement));
|
|
2010
|
-
exports["default"] = ExplicitConstructedResponse;
|
|
2011
|
-
(0, _defineProperty2["default"])(ExplicitConstructedResponse, "prepareModel", function () {
|
|
2012
|
-
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2013
|
-
var joinedObj = _objectSpread(_objectSpread({}, _defaults2["default"].model), model);
|
|
2014
|
-
var slateMarkup = joinedObj.slateMarkup || (0, _markupUtils.createSlateMarkup)(joinedObj.markup, joinedObj.choices);
|
|
2015
|
-
var processedMarkup = (0, _markupUtils.processMarkup)(slateMarkup);
|
|
2016
|
-
if (joinedObj.choices) {
|
|
2017
|
-
Object.keys(joinedObj.choices).forEach(function (key) {
|
|
2018
|
-
if ((0, _isArray["default"])(joinedObj.choices[key])) {
|
|
2019
|
-
joinedObj.choices[key] = (joinedObj.choices[key] || []).map(function (item, index) {
|
|
2020
|
-
if (!item.value) {
|
|
2021
|
-
log('Choice does not contain "value" property, which is required.', item);
|
|
2022
|
-
return _objectSpread({
|
|
2023
|
-
value: ("").concat(index)
|
|
2024
|
-
}, item);
|
|
2025
|
-
}
|
|
2026
|
-
return item;
|
|
2027
|
-
});
|
|
2028
|
-
}
|
|
2029
|
-
});
|
|
2030
|
-
}
|
|
2031
|
-
return _objectSpread(_objectSpread({}, joinedObj), {}, {
|
|
2032
|
-
slateMarkup: slateMarkup,
|
|
2033
|
-
markup: processedMarkup
|
|
2034
|
-
});
|
|
2035
|
-
});
|
|
2036
|
-
})(lib$1);
|
|
2037
|
-
var index = getDefaultExportFromCjs(lib$1);
|
|
2038
|
-
export {index as default};
|