react-survey-builder 1.0.8 → 1.0.10

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.
@@ -23,14 +23,15 @@ var _reactSelect = _interopRequireDefault(require("react-select"));
23
23
  var _reactSignatureCanvas = _interopRequireDefault(require("react-signature-canvas"));
24
24
  var _reactBootstrapRangeSlider = _interopRequireDefault(require("react-bootstrap-range-slider"));
25
25
  var _starRating = _interopRequireDefault(require("./star-rating"));
26
- var _datePicker = _interopRequireDefault(require("./date-picker"));
27
26
  var _componentHeader = _interopRequireDefault(require("./component-header"));
28
27
  var _componentLabel = _interopRequireDefault(require("./component-label"));
29
28
  var _myxss = _interopRequireDefault(require("./myxss"));
30
29
  var _fa = require("react-icons/fa");
31
30
  var _reactBootstrap = require("react-bootstrap");
32
31
  var _reactImask = require("react-imask");
33
- var _excluded = ["onChange"]; // eslint-disable-next-line max-classes-per-file
32
+ var _reactBootstrapTypeahead = require("react-bootstrap-typeahead");
33
+ var _excluded = ["onChange"],
34
+ _excluded2 = ["onChange", "formatMask"]; // eslint-disable-next-line max-classes-per-file
34
35
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
35
36
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
36
37
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
@@ -62,6 +63,71 @@ var CustomPhoneInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
62
63
  }
63
64
  }));
64
65
  });
66
+ var CustomDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
67
+ var onChange = _ref2.onChange,
68
+ _ref2$formatMask = _ref2.formatMask,
69
+ formatMask = _ref2$formatMask === void 0 ? 'MM/DD/YYYY' : _ref2$formatMask,
70
+ otherProps = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
71
+ return /*#__PURE__*/_react["default"].createElement(_reactImask.IMaskInput, (0, _extends2["default"])({}, otherProps, {
72
+ mask: Date,
73
+ lazy: false,
74
+ overwrite: true,
75
+ pattern: formatMask,
76
+ format: function format(date) {
77
+ var day = date.getDate();
78
+ var month = date.getMonth() + 1;
79
+ var year = date.getFullYear();
80
+ if (day < 10) day = "0" + day;
81
+ if (month < 10) month = "0" + month;
82
+ return [month, day, year].join('/');
83
+ },
84
+ autofix: true
85
+ // min={new Date(1900, 0, 1)}
86
+ // max={new Date()}
87
+ ,
88
+ blocks: {
89
+ DD: {
90
+ mask: IMask.MaskedRange,
91
+ from: 1,
92
+ to: 31,
93
+ maxLength: 2,
94
+ placeholderChar: 'D'
95
+ },
96
+ MM: {
97
+ mask: IMask.MaskedRange,
98
+ from: 1,
99
+ to: 12,
100
+ maxLength: 2,
101
+ placeholderChar: 'M'
102
+ },
103
+ YYYY: {
104
+ mask: IMask.MaskedRange,
105
+ from: 1900,
106
+ to: new Date().getFullYear() + 5,
107
+ placeholderChar: 'Y'
108
+ }
109
+ },
110
+ parse: function parse(str) {
111
+ var monthDayYear = str.split('/');
112
+ return new Date(monthDayYear[2], monthDayYear[0] - 1, monthDayYear[1]);
113
+ },
114
+ unmask: false // true|false|'typed'
115
+ ,
116
+ inputRef: ref
117
+ // inputRef={inputRef} // access to nested input
118
+ // DO NOT USE onChange TO HANDLE CHANGES!
119
+ // USE onAccept INSTEAD
120
+ ,
121
+ onAccept:
122
+ // depending on prop above first argument is
123
+ // `value` if `unmask=false`,
124
+ // `unmaskedValue` if `unmask=true`,
125
+ // `typedValue` if `unmask='typed'`
126
+ function onAccept(value, mask) {
127
+ onChange(value);
128
+ }
129
+ }));
130
+ });
65
131
  var SurveyElements = {};
66
132
  var Header = /*#__PURE__*/function (_React$Component) {
67
133
  (0, _inherits2["default"])(Header, _React$Component);
@@ -201,37 +267,57 @@ var TextInput = /*#__PURE__*/function (_React$Component5) {
201
267
  (0, _createClass2["default"])(TextInput, [{
202
268
  key: "render",
203
269
  value: function render() {
204
- var _this$props$data$plac;
270
+ var _this$props$data$plac,
271
+ _this2 = this;
205
272
  var props = {};
206
273
  props.type = 'text';
207
- //props.className = 'form-control';
208
274
  props.name = this.props.data.fieldName;
209
- props.help = this.props.data.help;
210
275
  props.placeholder = (_this$props$data$plac = this.props.data.placeholder) !== null && _this$props$data$plac !== void 0 ? _this$props$data$plac : _myxss["default"].process(this.props.data.label);
211
276
  if (this.props.mutable) {
212
277
  props.defaultValue = this.props.defaultValue;
213
278
  props.ref = this.inputField;
214
279
  }
215
- var baseClasses = 'SortableItem rfb-item';
216
- if (this.props.data.pageBreakBefore) {
217
- baseClasses += ' alwaysbreak';
280
+ if (this.props.onChange) {
281
+ props.onChange = function (e) {
282
+ _this2.props.onChange(e.target.value);
283
+ };
284
+ }
285
+ if (this.props.value) {
286
+ props.value = this.props.value;
287
+ }
288
+ if (this.props.isInvalid) {
289
+ props.isInvalid = this.props.isInvalid;
290
+ }
291
+ if (this.props.onBlur) {
292
+ props.onBlur = this.props.onBlur;
218
293
  }
219
294
  if (this.props.readOnly) {
220
295
  props.disabled = 'disabled';
221
296
  }
297
+ var labelLocation = 'ABOVE';
298
+ if (this.props.data.labelLocation) {
299
+ labelLocation = this.props.data.labelLocation;
300
+ }
301
+ var baseClasses = 'SortableItem rfb-item';
302
+ if (this.props.data.pageBreakBefore) {
303
+ baseClasses += ' alwaysbreak';
304
+ }
222
305
  return /*#__PURE__*/_react["default"].createElement("div", {
223
306
  style: _objectSpread({}, this.props.style),
224
307
  className: baseClasses
225
308
  }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
226
309
  className: "form-group mb-3"
227
- }, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
310
+ }, labelLocation === "FLOATING" ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
228
311
  id: props.name
229
312
  }, props)), /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
230
- name: props.name,
231
313
  htmlFor: props.name
232
- }))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
314
+ }))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
315
+ htmlFor: props.name
316
+ })), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
317
+ id: props.name
318
+ }, props))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
233
319
  muted: true
234
- }, props.help) : null));
320
+ }, this.props.data.help) : null));
235
321
  }
236
322
  }]);
237
323
  return TextInput;
@@ -240,45 +326,66 @@ var EmailInput = /*#__PURE__*/function (_React$Component6) {
240
326
  (0, _inherits2["default"])(EmailInput, _React$Component6);
241
327
  var _super6 = _createSuper(EmailInput);
242
328
  function EmailInput(props) {
243
- var _this2;
329
+ var _this3;
244
330
  (0, _classCallCheck2["default"])(this, EmailInput);
245
- _this2 = _super6.call(this, props);
246
- _this2.inputField = /*#__PURE__*/_react["default"].createRef();
247
- return _this2;
331
+ _this3 = _super6.call(this, props);
332
+ _this3.inputField = /*#__PURE__*/_react["default"].createRef();
333
+ return _this3;
248
334
  }
249
335
  (0, _createClass2["default"])(EmailInput, [{
250
336
  key: "render",
251
337
  value: function render() {
252
- var _this$props$data$plac2;
338
+ var _this$props$data$plac2,
339
+ _this4 = this;
253
340
  var props = {};
254
341
  props.type = 'text';
255
- // props.className = 'form-control';
256
342
  props.name = this.props.data.fieldName;
257
- props.help = this.props.data.help;
258
343
  props.placeholder = (_this$props$data$plac2 = this.props.data.placeholder) !== null && _this$props$data$plac2 !== void 0 ? _this$props$data$plac2 : _myxss["default"].process(this.props.data.label);
259
344
  if (this.props.mutable) {
260
345
  props.defaultValue = this.props.defaultValue;
261
346
  props.ref = this.inputField;
262
347
  }
263
- var baseClasses = 'SortableItem rfb-item';
264
- if (this.props.data.pageBreakBefore) {
265
- baseClasses += ' alwaysbreak';
348
+ if (this.props.onChange) {
349
+ props.onChange = function (e) {
350
+ _this4.props.onChange(e.target.value);
351
+ };
352
+ }
353
+ if (this.props.value) {
354
+ props.value = this.props.value;
355
+ }
356
+ if (this.props.isInvalid) {
357
+ props.isInvalid = this.props.isInvalid;
358
+ }
359
+ if (this.props.onBlur) {
360
+ props.onBlur = this.props.onBlur;
266
361
  }
267
362
  if (this.props.readOnly) {
268
363
  props.disabled = 'disabled';
269
364
  }
365
+ var labelLocation = 'ABOVE';
366
+ if (this.props.data.labelLocation) {
367
+ labelLocation = this.props.data.labelLocation;
368
+ }
369
+ var baseClasses = 'SortableItem rfb-item';
370
+ if (this.props.data.pageBreakBefore) {
371
+ baseClasses += ' alwaysbreak';
372
+ }
270
373
  return /*#__PURE__*/_react["default"].createElement("div", {
271
374
  style: _objectSpread({}, this.props.style),
272
375
  className: baseClasses
273
376
  }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
274
377
  className: "form-group mb-3"
275
- }, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
378
+ }, labelLocation === "FLOATING" ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
276
379
  id: props.name
277
380
  }, props)), /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
278
381
  htmlFor: props.name
279
- }))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
382
+ }))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
383
+ htmlFor: props.name
384
+ })), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
385
+ id: props.name
386
+ }, props))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
280
387
  muted: true
281
- }, props.help) : null));
388
+ }, this.props.data.help) : null));
282
389
  }
283
390
  }]);
284
391
  return EmailInput;
@@ -287,90 +394,199 @@ var PhoneNumber = /*#__PURE__*/function (_React$Component7) {
287
394
  (0, _inherits2["default"])(PhoneNumber, _React$Component7);
288
395
  var _super7 = _createSuper(PhoneNumber);
289
396
  function PhoneNumber(props) {
290
- var _this3;
397
+ var _this5;
291
398
  (0, _classCallCheck2["default"])(this, PhoneNumber);
292
- _this3 = _super7.call(this, props);
293
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "handleChange", function (e) {
294
- _this3.setState({
295
- value: e
296
- });
297
- });
298
- _this3.inputField = /*#__PURE__*/_react["default"].createRef();
299
- var defaultValue = props.defaultValue,
300
- data = props.data;
301
- _this3.state = {
302
- value: defaultValue
303
- };
304
- return _this3;
399
+ _this5 = _super7.call(this, props);
400
+ _this5.inputField = /*#__PURE__*/_react["default"].createRef();
401
+ return _this5;
305
402
  }
306
403
  (0, _createClass2["default"])(PhoneNumber, [{
307
404
  key: "render",
308
405
  value: function render() {
309
- var _this$props$data$plac3;
406
+ var _this$props$data$plac3,
407
+ _this6 = this;
310
408
  var props = {};
311
- props.type = 'tel';
312
- props.className = 'form-control';
409
+ props.type = 'text';
313
410
  props.name = this.props.data.fieldName;
314
- props.help = this.props.data.help;
315
411
  props.placeholder = (_this$props$data$plac3 = this.props.data.placeholder) !== null && _this$props$data$plac3 !== void 0 ? _this$props$data$plac3 : _myxss["default"].process(this.props.data.label);
316
412
  if (this.props.mutable) {
317
413
  props.defaultValue = this.props.defaultValue;
318
414
  props.ref = this.inputField;
319
415
  }
416
+ if (this.props.onChange) {
417
+ props.onChange = function (e) {
418
+ _this6.props.onChange(e);
419
+ };
420
+ }
421
+ if (this.props.value) {
422
+ props.value = this.props.value;
423
+ }
424
+ if (this.props.isInvalid) {
425
+ props.isInvalid = this.props.isInvalid;
426
+ }
427
+ if (this.props.onBlur) {
428
+ props.onBlur = this.props.onBlur;
429
+ }
430
+ if (this.props.readOnly) {
431
+ props.disabled = 'disabled';
432
+ }
433
+ props.autoComplete = "new-password";
434
+ var labelLocation = 'ABOVE';
435
+ if (this.props.data.labelLocation) {
436
+ labelLocation = this.props.data.labelLocation;
437
+ }
320
438
  var baseClasses = 'SortableItem rfb-item';
321
439
  if (this.props.data.pageBreakBefore) {
322
440
  baseClasses += ' alwaysbreak';
323
441
  }
442
+ return /*#__PURE__*/_react["default"].createElement("div", {
443
+ style: _objectSpread({}, this.props.style),
444
+ className: baseClasses
445
+ }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
446
+ className: "form-group mb-3"
447
+ }, labelLocation === "FLOATING" ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
448
+ id: props.name
449
+ }, props, {
450
+ as: CustomPhoneInput
451
+ })), /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
452
+ name: props.name,
453
+ htmlFor: props.name
454
+ }))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
455
+ name: props.name,
456
+ htmlFor: props.name
457
+ })), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
458
+ id: props.name
459
+ }, props, {
460
+ as: CustomPhoneInput
461
+ }))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
462
+ muted: true
463
+ }, this.props.data.help) : null));
464
+ }
465
+ }]);
466
+ return PhoneNumber;
467
+ }(_react["default"].Component);
468
+ var DatePicker = /*#__PURE__*/function (_React$Component8) {
469
+ (0, _inherits2["default"])(DatePicker, _React$Component8);
470
+ var _super8 = _createSuper(DatePicker);
471
+ function DatePicker(props) {
472
+ var _this7;
473
+ (0, _classCallCheck2["default"])(this, DatePicker);
474
+ _this7 = _super8.call(this, props);
475
+ _this7.inputField = /*#__PURE__*/_react["default"].createRef();
476
+ return _this7;
477
+ }
478
+ (0, _createClass2["default"])(DatePicker, [{
479
+ key: "render",
480
+ value: function render() {
481
+ var _this$props$data$plac4,
482
+ _this8 = this;
483
+ var props = {};
484
+ props.type = 'text';
485
+ props.name = this.props.data.fieldName;
486
+ props.placeholder = (_this$props$data$plac4 = this.props.data.placeholder) !== null && _this$props$data$plac4 !== void 0 ? _this$props$data$plac4 : _myxss["default"].process(this.props.data.label);
487
+ if (this.props.mutable) {
488
+ props.defaultValue = this.props.defaultValue;
489
+ props.ref = this.inputField;
490
+ }
491
+ props.formatMask = this.props.data.formatMask || 'MM/DD/YYYY';
492
+ if (this.props.onChange) {
493
+ props.onChange = function (e) {
494
+ _this8.props.onChange(e);
495
+ };
496
+ }
497
+ if (this.props.value) {
498
+ props.value = this.props.value;
499
+ }
500
+ if (this.props.isInvalid) {
501
+ props.isInvalid = this.props.isInvalid;
502
+ }
503
+ if (this.props.onBlur) {
504
+ props.onBlur = this.props.onBlur;
505
+ }
324
506
  if (this.props.readOnly) {
325
507
  props.disabled = 'disabled';
326
508
  }
509
+ props.autoComplete = "new-password";
510
+ var labelLocation = 'ABOVE';
511
+ if (this.props.data.labelLocation) {
512
+ labelLocation = this.props.data.labelLocation;
513
+ }
514
+ var baseClasses = 'SortableItem rfb-item';
515
+ if (this.props.data.pageBreakBefore) {
516
+ baseClasses += ' alwaysbreak';
517
+ }
327
518
  return /*#__PURE__*/_react["default"].createElement("div", {
328
519
  style: _objectSpread({}, this.props.style),
329
520
  className: baseClasses
330
521
  }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
331
522
  className: "form-group mb-3"
332
- }, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
523
+ }, labelLocation === "FLOATING" ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
333
524
  id: props.name
334
525
  }, props, {
335
- onChange: this.handleChange,
336
- as: CustomPhoneInput
526
+ as: CustomDateInput
337
527
  })), /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
528
+ name: props.name,
529
+ htmlFor: props.name
530
+ }))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
531
+ name: props.name,
338
532
  htmlFor: props.name
339
- }))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
533
+ })), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
534
+ id: props.name
535
+ }, props, {
536
+ as: CustomDateInput
537
+ }))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
340
538
  muted: true
341
- }, props.help) : null));
539
+ }, this.props.data.help) : null));
342
540
  }
343
541
  }]);
344
- return PhoneNumber;
542
+ return DatePicker;
345
543
  }(_react["default"].Component);
346
- var NumberInput = /*#__PURE__*/function (_React$Component8) {
347
- (0, _inherits2["default"])(NumberInput, _React$Component8);
348
- var _super8 = _createSuper(NumberInput);
544
+ var NumberInput = /*#__PURE__*/function (_React$Component9) {
545
+ (0, _inherits2["default"])(NumberInput, _React$Component9);
546
+ var _super9 = _createSuper(NumberInput);
349
547
  function NumberInput(props) {
350
- var _this4;
548
+ var _this9;
351
549
  (0, _classCallCheck2["default"])(this, NumberInput);
352
- _this4 = _super8.call(this, props);
353
- _this4.inputField = /*#__PURE__*/_react["default"].createRef();
354
- return _this4;
550
+ _this9 = _super9.call(this, props);
551
+ _this9.inputField = /*#__PURE__*/_react["default"].createRef();
552
+ return _this9;
355
553
  }
356
554
  (0, _createClass2["default"])(NumberInput, [{
357
555
  key: "render",
358
556
  value: function render() {
359
- var _this$props$data$plac4;
557
+ var _this$props$data$plac5,
558
+ _this10 = this;
360
559
  var props = {};
361
560
  props.type = 'number';
362
561
  props.name = this.props.data.fieldName;
363
- props.help = this.props.data.help;
364
- props.placeholder = (_this$props$data$plac4 = this.props.data.placeholder) !== null && _this$props$data$plac4 !== void 0 ? _this$props$data$plac4 : _myxss["default"].process(this.props.data.label);
562
+ props.placeholder = (_this$props$data$plac5 = this.props.data.placeholder) !== null && _this$props$data$plac5 !== void 0 ? _this$props$data$plac5 : _myxss["default"].process(this.props.data.label);
365
563
  if (this.props.mutable) {
366
564
  props.defaultValue = this.props.defaultValue;
367
565
  props.ref = this.inputField;
368
566
  }
567
+ if (this.props.onChange) {
568
+ props.onChange = function (e) {
569
+ _this10.props.onChange(e.target.value);
570
+ };
571
+ }
572
+ if (this.props.value) {
573
+ props.value = this.props.value;
574
+ }
575
+ if (this.props.isInvalid) {
576
+ props.isInvalid = this.props.isInvalid;
577
+ }
578
+ if (this.props.onBlur) {
579
+ props.onBlur = this.props.onBlur;
580
+ }
581
+ if (this.props.readOnly) {
582
+ props.disabled = 'disabled';
583
+ }
369
584
  props.min = this.props.data.minValue;
370
585
  props.max = this.props.data.maxValue;
371
586
  props.step = this.props.data.step;
372
- if (this.props.readOnly) {
373
- props.disabled = 'disabled';
587
+ var labelLocation = 'ABOVE';
588
+ if (this.props.data.labelLocation) {
589
+ labelLocation = this.props.data.labelLocation;
374
590
  }
375
591
  var baseClasses = 'SortableItem rfb-item';
376
592
  if (this.props.data.pageBreakBefore) {
@@ -381,42 +597,66 @@ var NumberInput = /*#__PURE__*/function (_React$Component8) {
381
597
  className: baseClasses
382
598
  }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
383
599
  className: "form-group mb-3"
384
- }, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
600
+ }, labelLocation === "FLOATING" ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
385
601
  id: props.name
386
602
  }, props)), /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
603
+ name: props.name,
387
604
  htmlFor: props.name
388
- }))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
605
+ }))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
606
+ name: props.name,
607
+ htmlFor: props.name
608
+ })), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
609
+ id: props.name
610
+ }, props))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
389
611
  muted: true
390
- }, props.help) : null));
612
+ }, this.props.data.help) : null));
391
613
  }
392
614
  }]);
393
615
  return NumberInput;
394
616
  }(_react["default"].Component);
395
- var TextArea = /*#__PURE__*/function (_React$Component9) {
396
- (0, _inherits2["default"])(TextArea, _React$Component9);
397
- var _super9 = _createSuper(TextArea);
617
+ var TextArea = /*#__PURE__*/function (_React$Component10) {
618
+ (0, _inherits2["default"])(TextArea, _React$Component10);
619
+ var _super10 = _createSuper(TextArea);
398
620
  function TextArea(props) {
399
- var _this5;
621
+ var _this11;
400
622
  (0, _classCallCheck2["default"])(this, TextArea);
401
- _this5 = _super9.call(this, props);
402
- _this5.inputField = /*#__PURE__*/_react["default"].createRef();
403
- return _this5;
623
+ _this11 = _super10.call(this, props);
624
+ _this11.inputField = /*#__PURE__*/_react["default"].createRef();
625
+ return _this11;
404
626
  }
405
627
  (0, _createClass2["default"])(TextArea, [{
406
628
  key: "render",
407
629
  value: function render() {
408
- var _this$props$data$plac5;
630
+ var _this$props$data$plac6,
631
+ _this12 = this;
409
632
  var props = {};
410
633
  props.name = this.props.data.fieldName;
411
- props.help = this.props.data.help;
412
- props.placeholder = (_this$props$data$plac5 = this.props.data.placeholder) !== null && _this$props$data$plac5 !== void 0 ? _this$props$data$plac5 : _myxss["default"].process(this.props.data.label);
413
- if (this.props.readOnly) {
414
- props.disabled = 'disabled';
415
- }
634
+ props.placeholder = (_this$props$data$plac6 = this.props.data.placeholder) !== null && _this$props$data$plac6 !== void 0 ? _this$props$data$plac6 : _myxss["default"].process(this.props.data.label);
416
635
  if (this.props.mutable) {
417
636
  props.defaultValue = this.props.defaultValue;
418
637
  props.ref = this.inputField;
419
638
  }
639
+ if (this.props.onChange) {
640
+ props.onChange = function (e) {
641
+ _this12.props.onChange(e.target.value);
642
+ };
643
+ }
644
+ if (this.props.value) {
645
+ props.value = this.props.value;
646
+ }
647
+ if (this.props.isInvalid) {
648
+ props.isInvalid = this.props.isInvalid;
649
+ }
650
+ if (this.props.onBlur) {
651
+ props.onBlur = this.props.onBlur;
652
+ }
653
+ if (this.props.readOnly) {
654
+ props.disabled = 'disabled';
655
+ }
656
+ var labelLocation = 'ABOVE';
657
+ if (this.props.data.labelLocation) {
658
+ labelLocation = this.props.data.labelLocation;
659
+ }
420
660
  var baseClasses = 'SortableItem rfb-item';
421
661
  if (this.props.data.pageBreakBefore) {
422
662
  baseClasses += ' alwaysbreak';
@@ -426,43 +666,67 @@ var TextArea = /*#__PURE__*/function (_React$Component9) {
426
666
  className: baseClasses
427
667
  }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
428
668
  className: "form-group mb-3"
429
- }, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
669
+ }, labelLocation === "FLOATING" ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
430
670
  as: "textarea",
431
671
  id: props.name
432
672
  }, props)), /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
673
+ name: props.name,
674
+ htmlFor: props.name
675
+ }))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
676
+ name: props.name,
433
677
  htmlFor: props.name
434
- }))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
678
+ })), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
679
+ as: "textarea",
680
+ id: props.name
681
+ }, props))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
435
682
  muted: true
436
- }, props.help) : null));
683
+ }, this.props.data.help) : null));
437
684
  }
438
685
  }]);
439
686
  return TextArea;
440
687
  }(_react["default"].Component);
441
- var Dropdown = /*#__PURE__*/function (_React$Component10) {
442
- (0, _inherits2["default"])(Dropdown, _React$Component10);
443
- var _super10 = _createSuper(Dropdown);
688
+ var Dropdown = /*#__PURE__*/function (_React$Component11) {
689
+ (0, _inherits2["default"])(Dropdown, _React$Component11);
690
+ var _super11 = _createSuper(Dropdown);
444
691
  function Dropdown(props) {
445
- var _this6;
692
+ var _this13;
446
693
  (0, _classCallCheck2["default"])(this, Dropdown);
447
- _this6 = _super10.call(this, props);
448
- _this6.inputField = /*#__PURE__*/_react["default"].createRef();
449
- return _this6;
694
+ _this13 = _super11.call(this, props);
695
+ _this13.inputField = /*#__PURE__*/_react["default"].createRef();
696
+ return _this13;
450
697
  }
451
698
  (0, _createClass2["default"])(Dropdown, [{
452
699
  key: "render",
453
700
  value: function render() {
701
+ var _this14 = this;
454
702
  var props = {};
455
- //props.className = 'form-select';
456
703
  props.name = this.props.data.fieldName;
457
- props.placeholder = this.props.data.placeholder;
458
- props.help = this.props.data.help;
704
+ props.placeholder = this.props.data.placeholder || 'Select One';
459
705
  if (this.props.mutable) {
460
706
  props.defaultValue = this.props.defaultValue;
461
707
  props.ref = this.inputField;
462
708
  }
709
+ if (this.props.onChange) {
710
+ props.onChange = function (e) {
711
+ _this14.props.onChange(e.target.value);
712
+ };
713
+ }
714
+ if (this.props.value) {
715
+ props.value = this.props.value;
716
+ }
717
+ if (this.props.isInvalid) {
718
+ props.isInvalid = this.props.isInvalid;
719
+ }
720
+ if (this.props.onBlur) {
721
+ props.onBlur = this.props.onBlur;
722
+ }
463
723
  if (this.props.readOnly) {
464
724
  props.disabled = 'disabled';
465
725
  }
726
+ var labelLocation = 'ABOVE';
727
+ if (this.props.data.labelLocation) {
728
+ labelLocation = this.props.data.labelLocation;
729
+ }
466
730
  var baseClasses = 'SortableItem rfb-item';
467
731
  if (this.props.data.pageBreakBefore) {
468
732
  baseClasses += ' alwaysbreak';
@@ -472,7 +736,7 @@ var Dropdown = /*#__PURE__*/function (_React$Component10) {
472
736
  className: baseClasses
473
737
  }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
474
738
  className: "form-group mb-3"
475
- }, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Select, (0, _extends2["default"])({
739
+ }, labelLocation === "FLOATING" ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Select, (0, _extends2["default"])({
476
740
  id: props.name
477
741
  }, props), props.placeholder ? /*#__PURE__*/_react["default"].createElement("option", {
478
742
  value: ""
@@ -483,45 +747,88 @@ var Dropdown = /*#__PURE__*/function (_React$Component10) {
483
747
  key: thisKey
484
748
  }, option.text);
485
749
  })), /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
750
+ name: props.name,
751
+ htmlFor: props.name
752
+ }))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
753
+ name: props.name,
486
754
  htmlFor: props.name
487
- }))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
755
+ })), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Select, (0, _extends2["default"])({
756
+ id: props.name
757
+ }, props), props.placeholder ? /*#__PURE__*/_react["default"].createElement("option", {
758
+ value: ""
759
+ }, props.placeholder) : null, this.props.data.options.map(function (option) {
760
+ var thisKey = "preview_".concat(option.key);
761
+ return /*#__PURE__*/_react["default"].createElement("option", {
762
+ value: option.value,
763
+ key: thisKey
764
+ }, option.text);
765
+ }))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
488
766
  muted: true
489
- }, props.help) : null));
767
+ }, this.props.data.help) : null));
490
768
  }
491
769
  }]);
492
770
  return Dropdown;
493
771
  }(_react["default"].Component);
494
- var Signature = /*#__PURE__*/function (_React$Component11) {
495
- (0, _inherits2["default"])(Signature, _React$Component11);
496
- var _super11 = _createSuper(Signature);
772
+ var Signature = /*#__PURE__*/function (_React$Component12) {
773
+ (0, _inherits2["default"])(Signature, _React$Component12);
774
+ var _super12 = _createSuper(Signature);
497
775
  function Signature(props) {
498
- var _this7;
776
+ var _this15;
499
777
  (0, _classCallCheck2["default"])(this, Signature);
500
- _this7 = _super11.call(this, props);
501
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this7), "clear", function () {
502
- if (_this7.state.defaultValue) {
503
- _this7.setState({
778
+ _this15 = _super12.call(this, props);
779
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this15), "clear", function () {
780
+ if (_this15.state.defaultValue) {
781
+ _this15.setState({
504
782
  defaultValue: ''
505
783
  });
506
- } else if (_this7.canvas.current) {
507
- _this7.canvas.current.clear();
784
+ } else if (_this15.canvas.current) {
785
+ _this15.canvas.current.clear();
508
786
  }
509
787
  });
510
- _this7.state = {
788
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this15), "_getSignatureImg", function () {
789
+ var $canvas_sig = _this15.canvas.current;
790
+ if ($canvas_sig) {
791
+ var base64 = $canvas_sig.toDataURL().replace('data:image/png;base64,', '');
792
+ var isEmpty = $canvas_sig.isEmpty();
793
+ var $input_sig = _this15.inputField.current;
794
+ var name = _this15.props.data.fieldName;
795
+ if (isEmpty) {
796
+ $input_sig.value = '';
797
+ if (_this15.props.methods) {
798
+ _this15.props.methods.setValue(name, '');
799
+ }
800
+ } else {
801
+ $input_sig.value = base64;
802
+ if (_this15.props.methods) {
803
+ _this15.props.methods.setValue(name, base64);
804
+ }
805
+ }
806
+ }
807
+ });
808
+ _this15.state = {
511
809
  defaultValue: props.defaultValue
512
810
  };
513
- _this7.inputField = /*#__PURE__*/_react["default"].createRef();
514
- _this7.canvas = /*#__PURE__*/_react["default"].createRef();
515
- return _this7;
811
+ _this15.inputField = /*#__PURE__*/_react["default"].createRef();
812
+ _this15.canvas = /*#__PURE__*/_react["default"].createRef();
813
+ return _this15;
516
814
  }
517
815
  (0, _createClass2["default"])(Signature, [{
518
816
  key: "render",
519
817
  value: function render() {
818
+ var _this16 = this;
520
819
  var defaultValue = this.state.defaultValue;
521
820
  var canClear = !!defaultValue;
522
821
  var props = {};
523
822
  props.type = 'hidden';
524
823
  props.name = this.props.data.fieldName;
824
+ if (this.props.onChange) {
825
+ props.onChange = function (e) {
826
+ _this16.props.onChange(e.target.value);
827
+ };
828
+ }
829
+ if (this.props.value) {
830
+ props.value = this.props.value;
831
+ }
525
832
  if (this.props.mutable) {
526
833
  props.defaultValue = defaultValue;
527
834
  props.ref = this.inputField;
@@ -541,6 +848,7 @@ var Signature = /*#__PURE__*/function (_React$Component11) {
541
848
  if (defaultValue && defaultValue.length > 0) {
542
849
  sourceDataURL = "data:image/png;base64,".concat(defaultValue);
543
850
  }
851
+ padProps.canvasProps = {};
544
852
  return /*#__PURE__*/_react["default"].createElement("div", {
545
853
  style: _objectSpread({}, this.props.style),
546
854
  className: baseClasses
@@ -548,37 +856,61 @@ var Signature = /*#__PURE__*/function (_React$Component11) {
548
856
  className: "form-group mb-3"
549
857
  }, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], this.props), this.props.readOnly === true || !!sourceDataURL ? /*#__PURE__*/_react["default"].createElement("img", {
550
858
  src: sourceDataURL
551
- }) : /*#__PURE__*/_react["default"].createElement(_reactSignatureCanvas["default"], padProps), canClear && /*#__PURE__*/_react["default"].createElement(_fa.FaTimes, {
552
- className: "clear-signature",
859
+ }) : /*#__PURE__*/_react["default"].createElement("div", {
860
+ className: "m-signature-pad"
861
+ }, /*#__PURE__*/_react["default"].createElement("div", {
862
+ className: "m-signature-pad--body"
863
+ }, /*#__PURE__*/_react["default"].createElement(_reactSignatureCanvas["default"], (0, _extends2["default"])({}, padProps, {
864
+ onEnd: function onEnd(e) {
865
+ _this16._getSignatureImg();
866
+ }
867
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
868
+ className: "m-signature-pad--footer clearfix"
869
+ }, canClear && /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Button, {
870
+ variant: "default",
871
+ size: "sm",
872
+ className: "clear-signature float-end",
553
873
  onClick: this.clear,
554
874
  title: "Clear Signature"
555
- }), /*#__PURE__*/_react["default"].createElement("input", props)));
875
+ }, /*#__PURE__*/_react["default"].createElement(_fa.FaTimes, null), " clear"))), this.props.methods ? /*#__PURE__*/_react["default"].createElement("input", (0, _extends2["default"])({}, this.props.methods.register(props.name), props)) : /*#__PURE__*/_react["default"].createElement("input", props)));
556
876
  }
557
877
  }]);
558
878
  return Signature;
559
879
  }(_react["default"].Component);
560
- var Tags = /*#__PURE__*/function (_React$Component12) {
561
- (0, _inherits2["default"])(Tags, _React$Component12);
562
- var _super12 = _createSuper(Tags);
563
- function Tags(props) {
564
- var _this8;
565
- (0, _classCallCheck2["default"])(this, Tags);
566
- _this8 = _super12.call(this, props);
567
- // state = { value: this.props.defaultValue !== undefined ? this.props.defaultValue.split(',') : [] };
568
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this8), "handleChange", function (e) {
569
- _this8.setState({
570
- value: e || []
880
+ var Tags2 = /*#__PURE__*/function (_React$Component13) {
881
+ (0, _inherits2["default"])(Tags2, _React$Component13);
882
+ var _super13 = _createSuper(Tags2);
883
+ function Tags2(props) {
884
+ var _this17;
885
+ (0, _classCallCheck2["default"])(this, Tags2);
886
+ _this17 = _super13.call(this, props);
887
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this17), "handleChange", function (e) {
888
+ _this17.setState({
889
+ value: e.map(function (i) {
890
+ return i.value;
891
+ }).join(',') || null
571
892
  });
893
+ if (_this17.props.onChange) {
894
+ _this17.props.onChange(e ? e.map(function (i) {
895
+ return i.value;
896
+ }).join(',') : null);
897
+ }
572
898
  });
573
- _this8.inputField = /*#__PURE__*/_react["default"].createRef();
899
+ _this17.inputField = /*#__PURE__*/_react["default"].createRef();
574
900
  var defaultValue = props.defaultValue,
575
901
  data = props.data;
576
- _this8.state = {
577
- value: _this8.getDefaultValue(defaultValue, data.options)
578
- };
579
- return _this8;
902
+ if (props.value) {
903
+ _this17.state = {
904
+ value: props.value
905
+ };
906
+ } else {
907
+ _this17.state = {
908
+ value: defaultValue
909
+ };
910
+ }
911
+ return _this17;
580
912
  }
581
- (0, _createClass2["default"])(Tags, [{
913
+ (0, _createClass2["default"])(Tags2, [{
582
914
  key: "getDefaultValue",
583
915
  value: function getDefaultValue(defaultValue, options) {
584
916
  if (defaultValue) {
@@ -607,52 +939,201 @@ var Tags = /*#__PURE__*/function (_React$Component12) {
607
939
  props.isMulti = true;
608
940
  props.name = this.props.data.fieldName;
609
941
  props.onChange = this.handleChange;
942
+
943
+ //if (this.props.isInvalid) { props.isInvalid = this.props.isInvalid; }
944
+ //if (this.props.onBlur) { props.onBlur = this.props.onBlur; }
945
+
610
946
  props.options = options;
611
947
  if (!this.props.mutable) {
612
948
  props.value = options[0].text;
613
949
  } // to show a sample of what tags looks like
614
950
  if (this.props.mutable) {
615
951
  props.isDisabled = this.props.readOnly;
616
- props.value = this.state.value;
952
+ props.value = this.getDefaultValue(this.state.value, options);
617
953
  props.ref = this.inputField;
618
954
  }
619
955
  var baseClasses = 'SortableItem rfb-item';
620
956
  if (this.props.data.pageBreakBefore) {
621
957
  baseClasses += ' alwaysbreak';
622
958
  }
959
+ var labelLocation = 'ABOVE';
960
+ if (this.props.data.labelLocation) {
961
+ labelLocation = this.props.data.labelLocation;
962
+ }
623
963
  return /*#__PURE__*/_react["default"].createElement("div", {
624
964
  style: _objectSpread({}, this.props.style),
625
965
  className: baseClasses
626
966
  }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
627
967
  className: "form-group mb-3"
628
- }, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactSelect["default"], props)));
968
+ }, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
969
+ name: props.name,
970
+ htmlFor: props.name
971
+ })), /*#__PURE__*/_react["default"].createElement(_reactSelect["default"], (0, _extends2["default"])({
972
+ id: props.name
973
+ }, props)), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
974
+ muted: true
975
+ }, this.props.data.help) : null));
976
+ }
977
+ }]);
978
+ return Tags2;
979
+ }(_react["default"].Component);
980
+ var Tags = /*#__PURE__*/function (_React$Component14) {
981
+ (0, _inherits2["default"])(Tags, _React$Component14);
982
+ var _super14 = _createSuper(Tags);
983
+ function Tags(props) {
984
+ var _this18;
985
+ (0, _classCallCheck2["default"])(this, Tags);
986
+ _this18 = _super14.call(this, props);
987
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this18), "handleChange", function (selected) {
988
+ if (selected !== undefined && selected !== null && selected.length > 0) {
989
+ _this18.setState({
990
+ value: selected.map(function (i) {
991
+ return i.id;
992
+ }).join(',')
993
+ });
994
+ if (_this18.props.onChange) {
995
+ _this18.props.onChange(selected.map(function (i) {
996
+ return i.id;
997
+ }).join(','));
998
+ }
999
+ } else {
1000
+ _this18.setState({
1001
+ value: []
1002
+ });
1003
+ if (_this18.props.onChange) {
1004
+ _this18.props.onChange([]);
1005
+ }
1006
+ }
1007
+ });
1008
+ _this18.inputField = /*#__PURE__*/_react["default"].createRef();
1009
+ var defaultValue = props.defaultValue,
1010
+ data = props.data;
1011
+ if (props.value) {
1012
+ _this18.state = {
1013
+ value: props.value
1014
+ };
1015
+ } else {
1016
+ _this18.state = {
1017
+ value: defaultValue
1018
+ };
1019
+ }
1020
+ return _this18;
1021
+ }
1022
+ (0, _createClass2["default"])(Tags, [{
1023
+ key: "getDefaultValue",
1024
+ value: function getDefaultValue(defaultValue, options) {
1025
+ console.log(defaultValue);
1026
+ if (defaultValue) {
1027
+ if (typeof defaultValue === 'string') {
1028
+ var vals = defaultValue.split(',').map(function (x) {
1029
+ return x.trim();
1030
+ });
1031
+ return options.filter(function (x) {
1032
+ return vals.indexOf(x.value) > -1;
1033
+ });
1034
+ }
1035
+ return options.filter(function (x) {
1036
+ return defaultValue.indexOf(x.value) > -1;
1037
+ });
1038
+ }
1039
+ return [];
1040
+ }
1041
+ }, {
1042
+ key: "render",
1043
+ value: function render() {
1044
+ var options = this.props.data.options.map(function (option) {
1045
+ option.label = option.text;
1046
+ option.id = option.value;
1047
+ return option;
1048
+ });
1049
+ var props = {};
1050
+ props.multiple = true;
1051
+ props.name = this.props.data.fieldName;
1052
+ props.onChange = this.handleChange;
1053
+ props.placeholder = this.props.data.placeholder || 'Select...';
1054
+ props.required = this.props.data.required;
1055
+ if (this.props.isInvalid) {
1056
+ props.isInvalid = this.props.isInvalid;
1057
+ }
1058
+ if (this.props.onBlur) {
1059
+ props.onBlur = this.props.onBlur;
1060
+ }
1061
+ props.options = options;
1062
+ if (this.props.mutable) {
1063
+ props.disabled = this.props.readOnly;
1064
+ props.selected = this.getDefaultValue(this.state.value, options);
1065
+ props.ref = this.inputField;
1066
+ }
1067
+ var baseClasses = 'SortableItem rfb-item';
1068
+ if (this.props.data.pageBreakBefore) {
1069
+ baseClasses += ' alwaysbreak';
1070
+ }
1071
+ var labelLocation = 'ABOVE';
1072
+ if (this.props.data.labelLocation) {
1073
+ labelLocation = this.props.data.labelLocation;
1074
+ }
1075
+ return /*#__PURE__*/_react["default"].createElement("div", {
1076
+ style: _objectSpread({}, this.props.style),
1077
+ className: baseClasses
1078
+ }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
1079
+ className: "form-group mb-3"
1080
+ }, labelLocation === "FLOATING" ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrapTypeahead.Typeahead, (0, _extends2["default"])({
1081
+ labelKey: function labelKey(option) {
1082
+ return option.label;
1083
+ },
1084
+ id: props.name
1085
+ }, props)), /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
1086
+ name: props.name,
1087
+ htmlFor: props.name
1088
+ }))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
1089
+ name: props.name,
1090
+ htmlFor: props.name
1091
+ })), /*#__PURE__*/_react["default"].createElement(_reactBootstrapTypeahead.Typeahead, (0, _extends2["default"])({
1092
+ labelKey: function labelKey(option) {
1093
+ return option.label;
1094
+ },
1095
+ id: props.name
1096
+ }, props))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
1097
+ muted: true
1098
+ }, this.props.data.help) : null));
629
1099
  }
630
1100
  }]);
631
1101
  return Tags;
632
1102
  }(_react["default"].Component);
633
- var Checkboxes = /*#__PURE__*/function (_React$Component13) {
634
- (0, _inherits2["default"])(Checkboxes, _React$Component13);
635
- var _super13 = _createSuper(Checkboxes);
1103
+ var Checkboxes = /*#__PURE__*/function (_React$Component15) {
1104
+ (0, _inherits2["default"])(Checkboxes, _React$Component15);
1105
+ var _super15 = _createSuper(Checkboxes);
636
1106
  function Checkboxes(props) {
637
- var _this9;
1107
+ var _this19;
638
1108
  (0, _classCallCheck2["default"])(this, Checkboxes);
639
- _this9 = _super13.call(this, props);
640
- _this9.options = {};
641
- return _this9;
1109
+ _this19 = _super15.call(this, props);
1110
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this19), "onCheckboxChange", function (checkboxValue, event) {
1111
+ if (_this19.props.onChange) {
1112
+ if (event.target.checked) {
1113
+ _this19.props.onChange(_this19.checkedValues.concat(checkboxValue));
1114
+ } else {
1115
+ _this19.props.onChange(_this19.checkedValues.filter(function (v) {
1116
+ return v !== checkboxValue;
1117
+ }));
1118
+ }
1119
+ }
1120
+ });
1121
+ _this19.options = {};
1122
+ _this19.checkedValues = [];
1123
+ return _this19;
642
1124
  }
643
1125
  (0, _createClass2["default"])(Checkboxes, [{
644
1126
  key: "render",
645
1127
  value: function render() {
646
- var _this10 = this;
1128
+ var _this20 = this;
647
1129
  var self = this;
648
- var classNames = ''; // 'custom-control custom-checkbox';
649
- if (this.props.data.inline) {
650
- classNames += ' option-inline';
651
- }
652
1130
  var baseClasses = 'SortableItem rfb-item';
653
1131
  if (this.props.data.pageBreakBefore) {
654
1132
  baseClasses += ' alwaysbreak';
655
1133
  }
1134
+ if (this.props.value) {
1135
+ this.checkedValues = this.props.value;
1136
+ }
656
1137
  return /*#__PURE__*/_react["default"].createElement("div", {
657
1138
  style: _objectSpread({}, this.props.style),
658
1139
  className: baseClasses
@@ -662,17 +1143,21 @@ var Checkboxes = /*#__PURE__*/function (_React$Component13) {
662
1143
  var thisKey = "preview_".concat(option.key);
663
1144
  var props = {};
664
1145
  props.name = "option_".concat(option.key);
665
- props.type = 'checkbox';
1146
+ if (self.props.data.inline) {
1147
+ props.inline = true;
1148
+ }
666
1149
  props.value = option.value;
667
1150
  if (self.props.mutable) {
668
1151
  props.defaultChecked = self.props.defaultValue !== undefined && self.props.defaultValue.indexOf(option.key) > -1;
669
1152
  }
670
- if (_this10.props.readOnly) {
1153
+ if (self.props.readOnly) {
671
1154
  props.disabled = 'disabled';
672
1155
  }
1156
+ if (self.props.value) {
1157
+ props.checked = _this20.props.value.indexOf(option.value) > -1;
1158
+ }
673
1159
  return /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Check, (0, _extends2["default"])({
674
1160
  label: option.text,
675
- className: classNames,
676
1161
  type: "checkbox",
677
1162
  key: thisKey,
678
1163
  id: "fid_".concat(thisKey),
@@ -680,6 +1165,9 @@ var Checkboxes = /*#__PURE__*/function (_React$Component13) {
680
1165
  if (c && self.props.mutable) {
681
1166
  self.options["child_ref_".concat(option.key)] = c;
682
1167
  }
1168
+ },
1169
+ onChange: function onChange(e) {
1170
+ self.onCheckboxChange(option.value, e);
683
1171
  }
684
1172
  }, props));
685
1173
  })));
@@ -687,22 +1175,20 @@ var Checkboxes = /*#__PURE__*/function (_React$Component13) {
687
1175
  }]);
688
1176
  return Checkboxes;
689
1177
  }(_react["default"].Component);
690
- var Checkbox = /*#__PURE__*/function (_React$Component14) {
691
- (0, _inherits2["default"])(Checkbox, _React$Component14);
692
- var _super14 = _createSuper(Checkbox);
1178
+ var Checkbox = /*#__PURE__*/function (_React$Component16) {
1179
+ (0, _inherits2["default"])(Checkbox, _React$Component16);
1180
+ var _super16 = _createSuper(Checkbox);
693
1181
  function Checkbox(props) {
694
- var _this11;
1182
+ var _this21;
695
1183
  (0, _classCallCheck2["default"])(this, Checkbox);
696
- _this11 = _super14.call(this, props);
697
- _this11.inputField = /*#__PURE__*/_react["default"].createRef();
698
- return _this11;
1184
+ _this21 = _super16.call(this, props);
1185
+ _this21.inputField = /*#__PURE__*/_react["default"].createRef();
1186
+ return _this21;
699
1187
  }
700
1188
  (0, _createClass2["default"])(Checkbox, [{
701
1189
  key: "render",
702
1190
  value: function render() {
703
- var classNames = ''; // 'custom-control custom-checkbox';
704
- // if (this.props.data.inline) { classNames += ' option-inline'; }
705
-
1191
+ var _this22 = this;
706
1192
  var baseClasses = 'SortableItem rfb-item';
707
1193
  if (this.props.data.pageBreakBefore) {
708
1194
  baseClasses += ' alwaysbreak';
@@ -715,9 +1201,26 @@ var Checkbox = /*#__PURE__*/function (_React$Component14) {
715
1201
  if (this.props.mutable) {
716
1202
  props.ref = this.inputField;
717
1203
  }
1204
+ if (this.props.onChange) {
1205
+ props.onChange = function (e) {
1206
+ _this22.props.onChange(e.target.checked);
1207
+ };
1208
+ }
1209
+ if (this.props.value) {
1210
+ props.checked = this.props.value;
1211
+ }
1212
+ if (this.props.isInvalid) {
1213
+ props.isInvalid = this.props.isInvalid;
1214
+ }
1215
+ if (this.props.onBlur) {
1216
+ props.onBlur = this.props.onBlur;
1217
+ }
718
1218
  if (this.props.readOnly) {
719
1219
  props.disabled = 'disabled';
720
1220
  }
1221
+ if (this.props.data.inline) {
1222
+ props.inline = true;
1223
+ }
721
1224
  return /*#__PURE__*/_react["default"].createElement("div", {
722
1225
  style: _objectSpread({}, this.props.style),
723
1226
  className: baseClasses
@@ -738,25 +1241,20 @@ var Checkbox = /*#__PURE__*/function (_React$Component14) {
738
1241
  }]);
739
1242
  return Checkbox;
740
1243
  }(_react["default"].Component);
741
- var RadioButtons = /*#__PURE__*/function (_React$Component15) {
742
- (0, _inherits2["default"])(RadioButtons, _React$Component15);
743
- var _super15 = _createSuper(RadioButtons);
1244
+ var RadioButtons = /*#__PURE__*/function (_React$Component17) {
1245
+ (0, _inherits2["default"])(RadioButtons, _React$Component17);
1246
+ var _super17 = _createSuper(RadioButtons);
744
1247
  function RadioButtons(props) {
745
- var _this12;
1248
+ var _this23;
746
1249
  (0, _classCallCheck2["default"])(this, RadioButtons);
747
- _this12 = _super15.call(this, props);
748
- _this12.options = {};
749
- return _this12;
1250
+ _this23 = _super17.call(this, props);
1251
+ _this23.options = {};
1252
+ return _this23;
750
1253
  }
751
1254
  (0, _createClass2["default"])(RadioButtons, [{
752
1255
  key: "render",
753
1256
  value: function render() {
754
- var _this13 = this;
755
1257
  var self = this;
756
- var classNames = ''; // 'custom-control custom-radio';
757
- if (this.props.data.inline) {
758
- classNames += ' option-inline';
759
- }
760
1258
  var baseClasses = 'SortableItem rfb-item';
761
1259
  if (this.props.data.pageBreakBefore) {
762
1260
  baseClasses += ' alwaysbreak';
@@ -770,17 +1268,26 @@ var RadioButtons = /*#__PURE__*/function (_React$Component15) {
770
1268
  var thisKey = "preview_".concat(option.key);
771
1269
  var props = {};
772
1270
  props.name = self.props.data.fieldName;
773
- props.type = 'radio';
774
1271
  props.value = option.value;
775
1272
  if (self.props.mutable) {
776
- props.defaultChecked = self.props.defaultValue !== undefined && (self.props.defaultValue.indexOf(option.key) > -1 || self.props.defaultValue.indexOf(option.value) > -1);
1273
+ props.defaultChecked = self.props.defaultValue !== undefined && self.props.defaultValue.indexOf(option.value) > -1;
1274
+ }
1275
+ if (self.props.onChange) {
1276
+ props.onChange = function (e) {
1277
+ self.props.onChange(e.target.value);
1278
+ };
777
1279
  }
778
- if (_this13.props.readOnly) {
1280
+ if (self.props.value) {
1281
+ props.checked = self.props.value === option.value;
1282
+ }
1283
+ if (self.props.readOnly) {
779
1284
  props.disabled = 'disabled';
780
1285
  }
1286
+ if (self.props.data.inline) {
1287
+ props.inline = true;
1288
+ }
781
1289
  return /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Check, (0, _extends2["default"])({
782
1290
  label: option.text,
783
- className: classNames,
784
1291
  type: "radio",
785
1292
  key: thisKey,
786
1293
  id: "fid_".concat(thisKey),
@@ -795,12 +1302,12 @@ var RadioButtons = /*#__PURE__*/function (_React$Component15) {
795
1302
  }]);
796
1303
  return RadioButtons;
797
1304
  }(_react["default"].Component);
798
- var Image = /*#__PURE__*/function (_React$Component16) {
799
- (0, _inherits2["default"])(Image, _React$Component16);
800
- var _super16 = _createSuper(Image);
1305
+ var Image = /*#__PURE__*/function (_React$Component18) {
1306
+ (0, _inherits2["default"])(Image, _React$Component18);
1307
+ var _super18 = _createSuper(Image);
801
1308
  function Image() {
802
1309
  (0, _classCallCheck2["default"])(this, Image);
803
- return _super16.apply(this, arguments);
1310
+ return _super18.apply(this, arguments);
804
1311
  }
805
1312
  (0, _createClass2["default"])(Image, [{
806
1313
  key: "render",
@@ -815,7 +1322,7 @@ var Image = /*#__PURE__*/function (_React$Component16) {
815
1322
  return /*#__PURE__*/_react["default"].createElement("div", {
816
1323
  style: _objectSpread(_objectSpread({}, this.props.style), style),
817
1324
  className: baseClasses
818
- }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), this.props.data.src && /*#__PURE__*/_react["default"].createElement("img", {
1325
+ }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), this.props.data.src && /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Image, {
819
1326
  src: this.props.data.src,
820
1327
  width: this.props.data.width,
821
1328
  height: this.props.data.height
@@ -826,19 +1333,20 @@ var Image = /*#__PURE__*/function (_React$Component16) {
826
1333
  }]);
827
1334
  return Image;
828
1335
  }(_react["default"].Component);
829
- var Rating = /*#__PURE__*/function (_React$Component17) {
830
- (0, _inherits2["default"])(Rating, _React$Component17);
831
- var _super17 = _createSuper(Rating);
1336
+ var Rating = /*#__PURE__*/function (_React$Component19) {
1337
+ (0, _inherits2["default"])(Rating, _React$Component19);
1338
+ var _super19 = _createSuper(Rating);
832
1339
  function Rating(props) {
833
- var _this14;
1340
+ var _this24;
834
1341
  (0, _classCallCheck2["default"])(this, Rating);
835
- _this14 = _super17.call(this, props);
836
- _this14.inputField = /*#__PURE__*/_react["default"].createRef();
837
- return _this14;
1342
+ _this24 = _super19.call(this, props);
1343
+ _this24.inputField = /*#__PURE__*/_react["default"].createRef();
1344
+ return _this24;
838
1345
  }
839
1346
  (0, _createClass2["default"])(Rating, [{
840
1347
  key: "render",
841
1348
  value: function render() {
1349
+ var _this25 = this;
842
1350
  var props = {};
843
1351
  props.name = this.props.data.fieldName;
844
1352
  props.ratingAmount = 5;
@@ -848,6 +1356,18 @@ var Rating = /*#__PURE__*/function (_React$Component17) {
848
1356
  props.disabled = this.props.readOnly;
849
1357
  props.ref = this.inputField;
850
1358
  }
1359
+ if (this.props.onChange) {
1360
+ props.onRatingClick = function (e, _ref3) {
1361
+ var rating = _ref3.rating;
1362
+ _this25.props.onChange(rating);
1363
+ };
1364
+ }
1365
+ if (this.props.value) {
1366
+ props.rating = this.props.value;
1367
+ }
1368
+ if (this.props.readOnly) {
1369
+ props.disabled = true;
1370
+ }
851
1371
  var baseClasses = 'SortableItem rfb-item';
852
1372
  if (this.props.data.pageBreakBefore) {
853
1373
  baseClasses += ' alwaysbreak';
@@ -862,12 +1382,12 @@ var Rating = /*#__PURE__*/function (_React$Component17) {
862
1382
  }]);
863
1383
  return Rating;
864
1384
  }(_react["default"].Component);
865
- var HyperLink = /*#__PURE__*/function (_React$Component18) {
866
- (0, _inherits2["default"])(HyperLink, _React$Component18);
867
- var _super18 = _createSuper(HyperLink);
1385
+ var HyperLink = /*#__PURE__*/function (_React$Component20) {
1386
+ (0, _inherits2["default"])(HyperLink, _React$Component20);
1387
+ var _super20 = _createSuper(HyperLink);
868
1388
  function HyperLink() {
869
1389
  (0, _classCallCheck2["default"])(this, HyperLink);
870
- return _super18.apply(this, arguments);
1390
+ return _super20.apply(this, arguments);
871
1391
  }
872
1392
  (0, _createClass2["default"])(HyperLink, [{
873
1393
  key: "render",
@@ -892,12 +1412,12 @@ var HyperLink = /*#__PURE__*/function (_React$Component18) {
892
1412
  }]);
893
1413
  return HyperLink;
894
1414
  }(_react["default"].Component);
895
- var Download = /*#__PURE__*/function (_React$Component19) {
896
- (0, _inherits2["default"])(Download, _React$Component19);
897
- var _super19 = _createSuper(Download);
1415
+ var Download = /*#__PURE__*/function (_React$Component21) {
1416
+ (0, _inherits2["default"])(Download, _React$Component21);
1417
+ var _super21 = _createSuper(Download);
898
1418
  function Download() {
899
1419
  (0, _classCallCheck2["default"])(this, Download);
900
- return _super19.apply(this, arguments);
1420
+ return _super21.apply(this, arguments);
901
1421
  }
902
1422
  (0, _createClass2["default"])(Download, [{
903
1423
  key: "render",
@@ -918,40 +1438,46 @@ var Download = /*#__PURE__*/function (_React$Component19) {
918
1438
  }]);
919
1439
  return Download;
920
1440
  }(_react["default"].Component);
921
- var Camera = /*#__PURE__*/function (_React$Component20) {
922
- (0, _inherits2["default"])(Camera, _React$Component20);
923
- var _super20 = _createSuper(Camera);
1441
+ var Camera = /*#__PURE__*/function (_React$Component22) {
1442
+ (0, _inherits2["default"])(Camera, _React$Component22);
1443
+ var _super22 = _createSuper(Camera);
924
1444
  function Camera(props) {
925
- var _this15;
1445
+ var _this26;
926
1446
  (0, _classCallCheck2["default"])(this, Camera);
927
- _this15 = _super20.call(this, props);
928
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this15), "displayImage", function (e) {
929
- var self = (0, _assertThisInitialized2["default"])(_this15);
1447
+ _this26 = _super22.call(this, props);
1448
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this26), "displayImage", function (e) {
1449
+ var self = (0, _assertThisInitialized2["default"])(_this26);
930
1450
  var target = e.target;
931
1451
  if (target.files && target.files.length) {
932
1452
  self.setState({
933
1453
  img: target.files[0],
934
1454
  previewImg: URL.createObjectURL(target.files[0])
935
1455
  });
1456
+ if (_this26.props.onChange) {
1457
+ _this26.props.onChange(target.files[0]);
1458
+ }
936
1459
  }
937
1460
  });
938
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this15), "clearImage", function () {
939
- _this15.setState({
1461
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this26), "clearImage", function (e) {
1462
+ _this26.setState({
940
1463
  img: null,
941
1464
  previewImg: null
942
1465
  });
1466
+ if (_this26.props.onChange) {
1467
+ _this26.props.onChange(null);
1468
+ }
943
1469
  });
944
- _this15.state = {
1470
+ _this26.state = {
945
1471
  img: null,
946
1472
  previewImg: null
947
1473
  };
948
- return _this15;
1474
+ return _this26;
949
1475
  }
950
1476
  (0, _createClass2["default"])(Camera, [{
951
1477
  key: "getImageSizeProps",
952
- value: function getImageSizeProps(_ref2) {
953
- var width = _ref2.width,
954
- height = _ref2.height;
1478
+ value: function getImageSizeProps(_ref4) {
1479
+ var width = _ref4.width,
1480
+ height = _ref4.height;
955
1481
  var imgProps = {
956
1482
  width: '100%'
957
1483
  };
@@ -966,7 +1492,7 @@ var Camera = /*#__PURE__*/function (_React$Component20) {
966
1492
  }, {
967
1493
  key: "render",
968
1494
  value: function render() {
969
- var _this16 = this;
1495
+ var _this27 = this;
970
1496
  var imageStyle = {
971
1497
  objectFit: 'scale-down',
972
1498
  objectPosition: this.props.data.center ? 'center' : 'left'
@@ -987,12 +1513,15 @@ var Camera = /*#__PURE__*/function (_React$Component20) {
987
1513
  sourceDataURL = "data:image/png;base64,".concat(this.props.defaultValue);
988
1514
  }
989
1515
  }
1516
+ if (this.props.value) {
1517
+ sourceDataURL = this.props.value;
1518
+ }
990
1519
  return /*#__PURE__*/_react["default"].createElement("div", {
991
1520
  style: _objectSpread({}, this.props.style),
992
1521
  className: baseClasses
993
1522
  }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
994
1523
  className: "form-group mb-3"
995
- }, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], this.props), this.props.readOnly === true && this.props.defaultValue && this.props.defaultValue.length > 0 ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("img", (0, _extends2["default"])({
1524
+ }, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], this.props), this.props.readOnly === true && this.props.defaultValue && this.props.defaultValue.length > 0 ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Image, (0, _extends2["default"])({
996
1525
  style: imageStyle,
997
1526
  src: sourceDataURL
998
1527
  }, this.getImageSizeProps(this.props.data)))) : /*#__PURE__*/_react["default"].createElement("div", {
@@ -1010,14 +1539,16 @@ var Camera = /*#__PURE__*/function (_React$Component20) {
1010
1539
  className: "image-upload-control"
1011
1540
  }, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Button, {
1012
1541
  variant: "light"
1013
- }, /*#__PURE__*/_react["default"].createElement(_fa.FaCamera, null), " Upload Photo"), /*#__PURE__*/_react["default"].createElement("p", null, "Select an image from your computer or device."))), this.state.img && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("img", {
1542
+ }, /*#__PURE__*/_react["default"].createElement(_fa.FaCamera, null), " Upload Photo"), /*#__PURE__*/_react["default"].createElement("p", null, "Select an image from your computer or device."))), this.state.img && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Image, {
1014
1543
  onLoad: function onLoad() {
1015
- return URL.revokeObjectURL(_this16.state.previewImg);
1544
+ return URL.revokeObjectURL(_this27.state.previewImg);
1016
1545
  },
1017
1546
  src: this.state.previewImg,
1018
1547
  height: "100",
1019
1548
  className: "image-upload-preview"
1020
1549
  }), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Button, {
1550
+ variant: "default",
1551
+ size: "sm",
1021
1552
  className: "btn-image-clear",
1022
1553
  onClick: this.clearImage
1023
1554
  }, /*#__PURE__*/_react["default"].createElement(_fa.FaTimes, null), " Clear Photo")))));
@@ -1025,15 +1556,15 @@ var Camera = /*#__PURE__*/function (_React$Component20) {
1025
1556
  }]);
1026
1557
  return Camera;
1027
1558
  }(_react["default"].Component);
1028
- var FileUpload = /*#__PURE__*/function (_React$Component21) {
1029
- (0, _inherits2["default"])(FileUpload, _React$Component21);
1030
- var _super21 = _createSuper(FileUpload);
1559
+ var FileUpload = /*#__PURE__*/function (_React$Component23) {
1560
+ (0, _inherits2["default"])(FileUpload, _React$Component23);
1561
+ var _super23 = _createSuper(FileUpload);
1031
1562
  function FileUpload(props) {
1032
- var _this17;
1563
+ var _this28;
1033
1564
  (0, _classCallCheck2["default"])(this, FileUpload);
1034
- _this17 = _super21.call(this, props);
1035
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this17), "displayFileUpload", function (e) {
1036
- var self = (0, _assertThisInitialized2["default"])(_this17);
1565
+ _this28 = _super23.call(this, props);
1566
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this28), "displayFileUpload", function (e) {
1567
+ var self = (0, _assertThisInitialized2["default"])(_this28);
1037
1568
  var target = e.target;
1038
1569
  var file;
1039
1570
  if (target.files && target.files.length > 0) {
@@ -1041,21 +1572,27 @@ var FileUpload = /*#__PURE__*/function (_React$Component21) {
1041
1572
  self.setState({
1042
1573
  fileUpload: file
1043
1574
  });
1575
+ if (_this28.props.onChange) {
1576
+ _this28.props.onChange(file);
1577
+ }
1044
1578
  }
1045
1579
  });
1046
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this17), "clearFileUpload", function () {
1047
- _this17.setState({
1580
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this28), "clearFileUpload", function () {
1581
+ _this28.setState({
1048
1582
  fileUpload: null
1049
1583
  });
1584
+ if (_this28.props.onChange) {
1585
+ _this28.props.onChange(null);
1586
+ }
1050
1587
  });
1051
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this17), "saveFile", /*#__PURE__*/function () {
1052
- var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(e) {
1588
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this28), "saveFile", /*#__PURE__*/function () {
1589
+ var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(e) {
1053
1590
  var sourceUrl, response, dispositionHeader, resBlob, blob, fileName, _fileName;
1054
1591
  return _regenerator["default"].wrap(function _callee$(_context) {
1055
1592
  while (1) switch (_context.prev = _context.next) {
1056
1593
  case 0:
1057
1594
  e.preventDefault();
1058
- sourceUrl = _this17.props.defaultValue;
1595
+ sourceUrl = _this28.props.defaultValue;
1059
1596
  _context.next = 4;
1060
1597
  return (0, _isomorphicFetch["default"])(sourceUrl, {
1061
1598
  method: 'GET',
@@ -1074,7 +1611,7 @@ var FileUpload = /*#__PURE__*/function (_React$Component21) {
1074
1611
  resBlob = _context.sent;
1075
1612
  // eslint-disable-next-line no-undef
1076
1613
  blob = new Blob([resBlob], {
1077
- type: _this17.props.data.fileType || response.headers.get('Content-Type')
1614
+ type: _this28.props.data.fileType || response.headers.get('Content-Type')
1078
1615
  });
1079
1616
  if (dispositionHeader && dispositionHeader.indexOf(';filename=') > -1) {
1080
1617
  fileName = dispositionHeader.split(';filename=')[1];
@@ -1090,13 +1627,13 @@ var FileUpload = /*#__PURE__*/function (_React$Component21) {
1090
1627
  }, _callee);
1091
1628
  }));
1092
1629
  return function (_x) {
1093
- return _ref3.apply(this, arguments);
1630
+ return _ref5.apply(this, arguments);
1094
1631
  };
1095
1632
  }());
1096
- _this17.state = {
1633
+ _this28.state = {
1097
1634
  fileUpload: null
1098
1635
  };
1099
- return _this17;
1636
+ return _this28;
1100
1637
  }
1101
1638
  (0, _createClass2["default"])(FileUpload, [{
1102
1639
  key: "render",
@@ -1144,6 +1681,8 @@ var FileUpload = /*#__PURE__*/function (_React$Component21) {
1144
1681
  marginLeft: '5px'
1145
1682
  }
1146
1683
  }, this.state.fileUpload.size.length > 6 ? "Size: ".concat(Math.ceil(this.state.fileUpload.size / (1024 * 1024)), " mb") : "Size: ".concat(Math.ceil(this.state.fileUpload.size / 1024), " kb"))), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Button, {
1684
+ variant: "default",
1685
+ size: "sm",
1147
1686
  className: "btn-file-upload-clear",
1148
1687
  onClick: this.clearFileUpload
1149
1688
  }, /*#__PURE__*/_react["default"].createElement(_fa.FaTimes, null), " Clear File")))));
@@ -1151,24 +1690,27 @@ var FileUpload = /*#__PURE__*/function (_React$Component21) {
1151
1690
  }]);
1152
1691
  return FileUpload;
1153
1692
  }(_react["default"].Component);
1154
- var Range = /*#__PURE__*/function (_React$Component22) {
1155
- (0, _inherits2["default"])(Range, _React$Component22);
1156
- var _super22 = _createSuper(Range);
1693
+ var Range = /*#__PURE__*/function (_React$Component24) {
1694
+ (0, _inherits2["default"])(Range, _React$Component24);
1695
+ var _super24 = _createSuper(Range);
1157
1696
  function Range(props) {
1158
- var _this18;
1697
+ var _this29;
1159
1698
  (0, _classCallCheck2["default"])(this, Range);
1160
- _this18 = _super22.call(this, props);
1161
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this18), "changeValue", function (e) {
1699
+ _this29 = _super24.call(this, props);
1700
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this29), "changeValue", function (e) {
1162
1701
  var target = e.target;
1163
- _this18.setState({
1702
+ _this29.setState({
1164
1703
  value: target.value
1165
1704
  });
1705
+ if (_this29.props.onChange) {
1706
+ _this29.props.onChange(target.value);
1707
+ }
1166
1708
  });
1167
- _this18.inputField = /*#__PURE__*/_react["default"].createRef();
1168
- _this18.state = {
1709
+ _this29.inputField = /*#__PURE__*/_react["default"].createRef();
1710
+ _this29.state = {
1169
1711
  value: props.defaultValue !== undefined ? parseInt(props.defaultValue, 10) : parseInt(props.data.defaultValue, 10)
1170
1712
  };
1171
- return _this18;
1713
+ return _this29;
1172
1714
  }
1173
1715
  (0, _createClass2["default"])(Range, [{
1174
1716
  key: "render",
@@ -1259,7 +1801,7 @@ SurveyElements.Dropdown = Dropdown;
1259
1801
  SurveyElements.Signature = Signature;
1260
1802
  SurveyElements.Checkboxes = Checkboxes;
1261
1803
  SurveyElements.Checkbox = Checkbox;
1262
- SurveyElements.DatePicker = _datePicker["default"];
1804
+ SurveyElements.DatePicker = DatePicker;
1263
1805
  SurveyElements.RadioButtons = RadioButtons;
1264
1806
  SurveyElements.Image = Image;
1265
1807
  SurveyElements.Rating = Rating;