react-survey-builder 1.0.9 → 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.
- package/README.md +8 -5
- package/dist/967.index.js +1 -1
- package/dist/app.css +1 -1
- package/dist/app.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +23 -0
- package/lib/form-fields.js +853 -0
- package/lib/form.js +35 -16
- package/lib/index.js +32 -3
- package/lib/language-provider/locales/en-us.json +2 -1
- package/lib/preview.js +1 -3
- package/lib/survey-elements/component-error-message.js +64 -0
- package/lib/survey-elements/index.js +709 -234
- package/lib/toolbar.js +138 -133
- package/package.json +12 -4
- package/types/index.d.ts +2 -0
@@ -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
|
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,17 +267,33 @@ 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
|
}
|
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;
|
293
|
+
}
|
294
|
+
if (this.props.readOnly) {
|
295
|
+
props.disabled = 'disabled';
|
296
|
+
}
|
215
297
|
var labelLocation = 'ABOVE';
|
216
298
|
if (this.props.data.labelLocation) {
|
217
299
|
labelLocation = this.props.data.labelLocation;
|
@@ -220,9 +302,6 @@ var TextInput = /*#__PURE__*/function (_React$Component5) {
|
|
220
302
|
if (this.props.data.pageBreakBefore) {
|
221
303
|
baseClasses += ' alwaysbreak';
|
222
304
|
}
|
223
|
-
if (this.props.readOnly) {
|
224
|
-
props.disabled = 'disabled';
|
225
|
-
}
|
226
305
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
227
306
|
style: _objectSpread({}, this.props.style),
|
228
307
|
className: baseClasses
|
@@ -236,9 +315,9 @@ var TextInput = /*#__PURE__*/function (_React$Component5) {
|
|
236
315
|
htmlFor: props.name
|
237
316
|
})), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
|
238
317
|
id: props.name
|
239
|
-
}, props))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
318
|
+
}, props))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
240
319
|
muted: true
|
241
|
-
}, props.help) : null));
|
320
|
+
}, this.props.data.help) : null));
|
242
321
|
}
|
243
322
|
}]);
|
244
323
|
return TextInput;
|
@@ -247,26 +326,42 @@ var EmailInput = /*#__PURE__*/function (_React$Component6) {
|
|
247
326
|
(0, _inherits2["default"])(EmailInput, _React$Component6);
|
248
327
|
var _super6 = _createSuper(EmailInput);
|
249
328
|
function EmailInput(props) {
|
250
|
-
var
|
329
|
+
var _this3;
|
251
330
|
(0, _classCallCheck2["default"])(this, EmailInput);
|
252
|
-
|
253
|
-
|
254
|
-
return
|
331
|
+
_this3 = _super6.call(this, props);
|
332
|
+
_this3.inputField = /*#__PURE__*/_react["default"].createRef();
|
333
|
+
return _this3;
|
255
334
|
}
|
256
335
|
(0, _createClass2["default"])(EmailInput, [{
|
257
336
|
key: "render",
|
258
337
|
value: function render() {
|
259
|
-
var _this$props$data$plac2
|
338
|
+
var _this$props$data$plac2,
|
339
|
+
_this4 = this;
|
260
340
|
var props = {};
|
261
341
|
props.type = 'text';
|
262
|
-
// props.className = 'form-control';
|
263
342
|
props.name = this.props.data.fieldName;
|
264
|
-
props.help = this.props.data.help;
|
265
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);
|
266
344
|
if (this.props.mutable) {
|
267
345
|
props.defaultValue = this.props.defaultValue;
|
268
346
|
props.ref = this.inputField;
|
269
347
|
}
|
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;
|
361
|
+
}
|
362
|
+
if (this.props.readOnly) {
|
363
|
+
props.disabled = 'disabled';
|
364
|
+
}
|
270
365
|
var labelLocation = 'ABOVE';
|
271
366
|
if (this.props.data.labelLocation) {
|
272
367
|
labelLocation = this.props.data.labelLocation;
|
@@ -275,9 +370,6 @@ var EmailInput = /*#__PURE__*/function (_React$Component6) {
|
|
275
370
|
if (this.props.data.pageBreakBefore) {
|
276
371
|
baseClasses += ' alwaysbreak';
|
277
372
|
}
|
278
|
-
if (this.props.readOnly) {
|
279
|
-
props.disabled = 'disabled';
|
280
|
-
}
|
281
373
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
282
374
|
style: _objectSpread({}, this.props.style),
|
283
375
|
className: baseClasses
|
@@ -291,9 +383,9 @@ var EmailInput = /*#__PURE__*/function (_React$Component6) {
|
|
291
383
|
htmlFor: props.name
|
292
384
|
})), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
|
293
385
|
id: props.name
|
294
|
-
}, props))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
386
|
+
}, props))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
295
387
|
muted: true
|
296
|
-
}, props.help) : null));
|
388
|
+
}, this.props.data.help) : null));
|
297
389
|
}
|
298
390
|
}]);
|
299
391
|
return EmailInput;
|
@@ -302,36 +394,43 @@ var PhoneNumber = /*#__PURE__*/function (_React$Component7) {
|
|
302
394
|
(0, _inherits2["default"])(PhoneNumber, _React$Component7);
|
303
395
|
var _super7 = _createSuper(PhoneNumber);
|
304
396
|
function PhoneNumber(props) {
|
305
|
-
var
|
397
|
+
var _this5;
|
306
398
|
(0, _classCallCheck2["default"])(this, PhoneNumber);
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
value: e
|
311
|
-
});
|
312
|
-
});
|
313
|
-
_this3.inputField = /*#__PURE__*/_react["default"].createRef();
|
314
|
-
var defaultValue = props.defaultValue,
|
315
|
-
data = props.data;
|
316
|
-
_this3.state = {
|
317
|
-
value: defaultValue
|
318
|
-
};
|
319
|
-
return _this3;
|
399
|
+
_this5 = _super7.call(this, props);
|
400
|
+
_this5.inputField = /*#__PURE__*/_react["default"].createRef();
|
401
|
+
return _this5;
|
320
402
|
}
|
321
403
|
(0, _createClass2["default"])(PhoneNumber, [{
|
322
404
|
key: "render",
|
323
405
|
value: function render() {
|
324
|
-
var _this$props$data$plac3
|
406
|
+
var _this$props$data$plac3,
|
407
|
+
_this6 = this;
|
325
408
|
var props = {};
|
326
|
-
props.type = '
|
327
|
-
props.className = 'form-control';
|
409
|
+
props.type = 'text';
|
328
410
|
props.name = this.props.data.fieldName;
|
329
|
-
props.help = this.props.data.help;
|
330
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);
|
331
412
|
if (this.props.mutable) {
|
332
413
|
props.defaultValue = this.props.defaultValue;
|
333
414
|
props.ref = this.inputField;
|
334
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";
|
335
434
|
var labelLocation = 'ABOVE';
|
336
435
|
if (this.props.data.labelLocation) {
|
337
436
|
labelLocation = this.props.data.labelLocation;
|
@@ -340,9 +439,6 @@ var PhoneNumber = /*#__PURE__*/function (_React$Component7) {
|
|
340
439
|
if (this.props.data.pageBreakBefore) {
|
341
440
|
baseClasses += ' alwaysbreak';
|
342
441
|
}
|
343
|
-
if (this.props.readOnly) {
|
344
|
-
props.disabled = 'disabled';
|
345
|
-
}
|
346
442
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
347
443
|
style: _objectSpread({}, this.props.style),
|
348
444
|
className: baseClasses
|
@@ -351,7 +447,6 @@ var PhoneNumber = /*#__PURE__*/function (_React$Component7) {
|
|
351
447
|
}, labelLocation === "FLOATING" ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
|
352
448
|
id: props.name
|
353
449
|
}, props, {
|
354
|
-
onChange: this.handleChange,
|
355
450
|
as: CustomPhoneInput
|
356
451
|
})), /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
|
357
452
|
name: props.name,
|
@@ -362,38 +457,130 @@ var PhoneNumber = /*#__PURE__*/function (_React$Component7) {
|
|
362
457
|
})), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
|
363
458
|
id: props.name
|
364
459
|
}, props, {
|
365
|
-
onChange: this.handleChange,
|
366
460
|
as: CustomPhoneInput
|
367
|
-
}))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
461
|
+
}))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
368
462
|
muted: true
|
369
|
-
}, props.help) : null));
|
463
|
+
}, this.props.data.help) : null));
|
370
464
|
}
|
371
465
|
}]);
|
372
466
|
return PhoneNumber;
|
373
467
|
}(_react["default"].Component);
|
374
|
-
var
|
375
|
-
(0, _inherits2["default"])(
|
376
|
-
var _super8 = _createSuper(
|
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
|
+
}
|
506
|
+
if (this.props.readOnly) {
|
507
|
+
props.disabled = 'disabled';
|
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
|
+
}
|
518
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
519
|
+
style: _objectSpread({}, this.props.style),
|
520
|
+
className: baseClasses
|
521
|
+
}, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
|
522
|
+
className: "form-group mb-3"
|
523
|
+
}, labelLocation === "FLOATING" ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Floating, null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
|
524
|
+
id: props.name
|
525
|
+
}, props, {
|
526
|
+
as: CustomDateInput
|
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,
|
532
|
+
htmlFor: props.name
|
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, {
|
538
|
+
muted: true
|
539
|
+
}, this.props.data.help) : null));
|
540
|
+
}
|
541
|
+
}]);
|
542
|
+
return DatePicker;
|
543
|
+
}(_react["default"].Component);
|
544
|
+
var NumberInput = /*#__PURE__*/function (_React$Component9) {
|
545
|
+
(0, _inherits2["default"])(NumberInput, _React$Component9);
|
546
|
+
var _super9 = _createSuper(NumberInput);
|
377
547
|
function NumberInput(props) {
|
378
|
-
var
|
548
|
+
var _this9;
|
379
549
|
(0, _classCallCheck2["default"])(this, NumberInput);
|
380
|
-
|
381
|
-
|
382
|
-
return
|
550
|
+
_this9 = _super9.call(this, props);
|
551
|
+
_this9.inputField = /*#__PURE__*/_react["default"].createRef();
|
552
|
+
return _this9;
|
383
553
|
}
|
384
554
|
(0, _createClass2["default"])(NumberInput, [{
|
385
555
|
key: "render",
|
386
556
|
value: function render() {
|
387
|
-
var _this$props$data$
|
557
|
+
var _this$props$data$plac5,
|
558
|
+
_this10 = this;
|
388
559
|
var props = {};
|
389
560
|
props.type = 'number';
|
390
561
|
props.name = this.props.data.fieldName;
|
391
|
-
props.
|
392
|
-
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);
|
393
563
|
if (this.props.mutable) {
|
394
564
|
props.defaultValue = this.props.defaultValue;
|
395
565
|
props.ref = this.inputField;
|
396
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
|
+
}
|
397
584
|
props.min = this.props.data.minValue;
|
398
585
|
props.max = this.props.data.maxValue;
|
399
586
|
props.step = this.props.data.step;
|
@@ -401,9 +588,6 @@ var NumberInput = /*#__PURE__*/function (_React$Component8) {
|
|
401
588
|
if (this.props.data.labelLocation) {
|
402
589
|
labelLocation = this.props.data.labelLocation;
|
403
590
|
}
|
404
|
-
if (this.props.readOnly) {
|
405
|
-
props.disabled = 'disabled';
|
406
|
-
}
|
407
591
|
var baseClasses = 'SortableItem rfb-item';
|
408
592
|
if (this.props.data.pageBreakBefore) {
|
409
593
|
baseClasses += ' alwaysbreak';
|
@@ -423,38 +607,52 @@ var NumberInput = /*#__PURE__*/function (_React$Component8) {
|
|
423
607
|
htmlFor: props.name
|
424
608
|
})), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
|
425
609
|
id: props.name
|
426
|
-
}, props))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
610
|
+
}, props))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
427
611
|
muted: true
|
428
|
-
}, props.help) : null));
|
612
|
+
}, this.props.data.help) : null));
|
429
613
|
}
|
430
614
|
}]);
|
431
615
|
return NumberInput;
|
432
616
|
}(_react["default"].Component);
|
433
|
-
var TextArea = /*#__PURE__*/function (_React$
|
434
|
-
(0, _inherits2["default"])(TextArea, _React$
|
435
|
-
var
|
617
|
+
var TextArea = /*#__PURE__*/function (_React$Component10) {
|
618
|
+
(0, _inherits2["default"])(TextArea, _React$Component10);
|
619
|
+
var _super10 = _createSuper(TextArea);
|
436
620
|
function TextArea(props) {
|
437
|
-
var
|
621
|
+
var _this11;
|
438
622
|
(0, _classCallCheck2["default"])(this, TextArea);
|
439
|
-
|
440
|
-
|
441
|
-
return
|
623
|
+
_this11 = _super10.call(this, props);
|
624
|
+
_this11.inputField = /*#__PURE__*/_react["default"].createRef();
|
625
|
+
return _this11;
|
442
626
|
}
|
443
627
|
(0, _createClass2["default"])(TextArea, [{
|
444
628
|
key: "render",
|
445
629
|
value: function render() {
|
446
|
-
var _this$props$data$
|
630
|
+
var _this$props$data$plac6,
|
631
|
+
_this12 = this;
|
447
632
|
var props = {};
|
448
633
|
props.name = this.props.data.fieldName;
|
449
|
-
props.
|
450
|
-
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);
|
451
|
-
if (this.props.readOnly) {
|
452
|
-
props.disabled = 'disabled';
|
453
|
-
}
|
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);
|
454
635
|
if (this.props.mutable) {
|
455
636
|
props.defaultValue = this.props.defaultValue;
|
456
637
|
props.ref = this.inputField;
|
457
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
|
+
}
|
458
656
|
var labelLocation = 'ABOVE';
|
459
657
|
if (this.props.data.labelLocation) {
|
460
658
|
labelLocation = this.props.data.labelLocation;
|
@@ -480,42 +678,55 @@ var TextArea = /*#__PURE__*/function (_React$Component9) {
|
|
480
678
|
})), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Control, (0, _extends2["default"])({
|
481
679
|
as: "textarea",
|
482
680
|
id: props.name
|
483
|
-
}, props))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
681
|
+
}, props))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
484
682
|
muted: true
|
485
|
-
}, props.help) : null));
|
683
|
+
}, this.props.data.help) : null));
|
486
684
|
}
|
487
685
|
}]);
|
488
686
|
return TextArea;
|
489
687
|
}(_react["default"].Component);
|
490
|
-
var Dropdown = /*#__PURE__*/function (_React$
|
491
|
-
(0, _inherits2["default"])(Dropdown, _React$
|
492
|
-
var
|
688
|
+
var Dropdown = /*#__PURE__*/function (_React$Component11) {
|
689
|
+
(0, _inherits2["default"])(Dropdown, _React$Component11);
|
690
|
+
var _super11 = _createSuper(Dropdown);
|
493
691
|
function Dropdown(props) {
|
494
|
-
var
|
692
|
+
var _this13;
|
495
693
|
(0, _classCallCheck2["default"])(this, Dropdown);
|
496
|
-
|
497
|
-
|
498
|
-
return
|
694
|
+
_this13 = _super11.call(this, props);
|
695
|
+
_this13.inputField = /*#__PURE__*/_react["default"].createRef();
|
696
|
+
return _this13;
|
499
697
|
}
|
500
698
|
(0, _createClass2["default"])(Dropdown, [{
|
501
699
|
key: "render",
|
502
700
|
value: function render() {
|
701
|
+
var _this14 = this;
|
503
702
|
var props = {};
|
504
|
-
//props.className = 'form-select';
|
505
703
|
props.name = this.props.data.fieldName;
|
506
|
-
props.placeholder = this.props.data.placeholder;
|
507
|
-
props.help = this.props.data.help;
|
704
|
+
props.placeholder = this.props.data.placeholder || 'Select One';
|
508
705
|
if (this.props.mutable) {
|
509
706
|
props.defaultValue = this.props.defaultValue;
|
510
707
|
props.ref = this.inputField;
|
511
708
|
}
|
512
|
-
|
513
|
-
|
514
|
-
|
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;
|
515
722
|
}
|
516
723
|
if (this.props.readOnly) {
|
517
724
|
props.disabled = 'disabled';
|
518
725
|
}
|
726
|
+
var labelLocation = 'ABOVE';
|
727
|
+
if (this.props.data.labelLocation) {
|
728
|
+
labelLocation = this.props.data.labelLocation;
|
729
|
+
}
|
519
730
|
var baseClasses = 'SortableItem rfb-item';
|
520
731
|
if (this.props.data.pageBreakBefore) {
|
521
732
|
baseClasses += ' alwaysbreak';
|
@@ -551,44 +762,73 @@ var Dropdown = /*#__PURE__*/function (_React$Component10) {
|
|
551
762
|
value: option.value,
|
552
763
|
key: thisKey
|
553
764
|
}, option.text);
|
554
|
-
}))), props.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
765
|
+
}))), this.props.data.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
|
555
766
|
muted: true
|
556
|
-
}, props.help) : null));
|
767
|
+
}, this.props.data.help) : null));
|
557
768
|
}
|
558
769
|
}]);
|
559
770
|
return Dropdown;
|
560
771
|
}(_react["default"].Component);
|
561
|
-
var Signature = /*#__PURE__*/function (_React$
|
562
|
-
(0, _inherits2["default"])(Signature, _React$
|
563
|
-
var
|
772
|
+
var Signature = /*#__PURE__*/function (_React$Component12) {
|
773
|
+
(0, _inherits2["default"])(Signature, _React$Component12);
|
774
|
+
var _super12 = _createSuper(Signature);
|
564
775
|
function Signature(props) {
|
565
|
-
var
|
776
|
+
var _this15;
|
566
777
|
(0, _classCallCheck2["default"])(this, Signature);
|
567
|
-
|
568
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
569
|
-
if (
|
570
|
-
|
778
|
+
_this15 = _super12.call(this, props);
|
779
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this15), "clear", function () {
|
780
|
+
if (_this15.state.defaultValue) {
|
781
|
+
_this15.setState({
|
571
782
|
defaultValue: ''
|
572
783
|
});
|
573
|
-
} else if (
|
574
|
-
|
784
|
+
} else if (_this15.canvas.current) {
|
785
|
+
_this15.canvas.current.clear();
|
575
786
|
}
|
576
787
|
});
|
577
|
-
|
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 = {
|
578
809
|
defaultValue: props.defaultValue
|
579
810
|
};
|
580
|
-
|
581
|
-
|
582
|
-
return
|
811
|
+
_this15.inputField = /*#__PURE__*/_react["default"].createRef();
|
812
|
+
_this15.canvas = /*#__PURE__*/_react["default"].createRef();
|
813
|
+
return _this15;
|
583
814
|
}
|
584
815
|
(0, _createClass2["default"])(Signature, [{
|
585
816
|
key: "render",
|
586
817
|
value: function render() {
|
818
|
+
var _this16 = this;
|
587
819
|
var defaultValue = this.state.defaultValue;
|
588
820
|
var canClear = !!defaultValue;
|
589
821
|
var props = {};
|
590
822
|
props.type = 'hidden';
|
591
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
|
+
}
|
592
832
|
if (this.props.mutable) {
|
593
833
|
props.defaultValue = defaultValue;
|
594
834
|
props.ref = this.inputField;
|
@@ -608,6 +848,7 @@ var Signature = /*#__PURE__*/function (_React$Component11) {
|
|
608
848
|
if (defaultValue && defaultValue.length > 0) {
|
609
849
|
sourceDataURL = "data:image/png;base64,".concat(defaultValue);
|
610
850
|
}
|
851
|
+
padProps.canvasProps = {};
|
611
852
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
612
853
|
style: _objectSpread({}, this.props.style),
|
613
854
|
className: baseClasses
|
@@ -615,37 +856,61 @@ var Signature = /*#__PURE__*/function (_React$Component11) {
|
|
615
856
|
className: "form-group mb-3"
|
616
857
|
}, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], this.props), this.props.readOnly === true || !!sourceDataURL ? /*#__PURE__*/_react["default"].createElement("img", {
|
617
858
|
src: sourceDataURL
|
618
|
-
}) : /*#__PURE__*/_react["default"].createElement(
|
619
|
-
className: "
|
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",
|
620
873
|
onClick: this.clear,
|
621
874
|
title: "Clear Signature"
|
622
|
-
}), /*#__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)));
|
623
876
|
}
|
624
877
|
}]);
|
625
878
|
return Signature;
|
626
879
|
}(_react["default"].Component);
|
627
|
-
var
|
628
|
-
(0, _inherits2["default"])(
|
629
|
-
var
|
630
|
-
function
|
631
|
-
var
|
632
|
-
(0, _classCallCheck2["default"])(this,
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
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
|
638
892
|
});
|
893
|
+
if (_this17.props.onChange) {
|
894
|
+
_this17.props.onChange(e ? e.map(function (i) {
|
895
|
+
return i.value;
|
896
|
+
}).join(',') : null);
|
897
|
+
}
|
639
898
|
});
|
640
|
-
|
899
|
+
_this17.inputField = /*#__PURE__*/_react["default"].createRef();
|
641
900
|
var defaultValue = props.defaultValue,
|
642
901
|
data = props.data;
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
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;
|
647
912
|
}
|
648
|
-
(0, _createClass2["default"])(
|
913
|
+
(0, _createClass2["default"])(Tags2, [{
|
649
914
|
key: "getDefaultValue",
|
650
915
|
value: function getDefaultValue(defaultValue, options) {
|
651
916
|
if (defaultValue) {
|
@@ -674,52 +939,201 @@ var Tags = /*#__PURE__*/function (_React$Component12) {
|
|
674
939
|
props.isMulti = true;
|
675
940
|
props.name = this.props.data.fieldName;
|
676
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
|
+
|
677
946
|
props.options = options;
|
678
947
|
if (!this.props.mutable) {
|
679
948
|
props.value = options[0].text;
|
680
949
|
} // to show a sample of what tags looks like
|
681
950
|
if (this.props.mutable) {
|
682
951
|
props.isDisabled = this.props.readOnly;
|
683
|
-
props.value = this.state.value;
|
952
|
+
props.value = this.getDefaultValue(this.state.value, options);
|
684
953
|
props.ref = this.inputField;
|
685
954
|
}
|
686
955
|
var baseClasses = 'SortableItem rfb-item';
|
687
956
|
if (this.props.data.pageBreakBefore) {
|
688
957
|
baseClasses += ' alwaysbreak';
|
689
958
|
}
|
959
|
+
var labelLocation = 'ABOVE';
|
960
|
+
if (this.props.data.labelLocation) {
|
961
|
+
labelLocation = this.props.data.labelLocation;
|
962
|
+
}
|
690
963
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
691
964
|
style: _objectSpread({}, this.props.style),
|
692
965
|
className: baseClasses
|
693
966
|
}, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
|
694
967
|
className: "form-group mb-3"
|
695
|
-
}, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"],
|
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));
|
696
1099
|
}
|
697
1100
|
}]);
|
698
1101
|
return Tags;
|
699
1102
|
}(_react["default"].Component);
|
700
|
-
var Checkboxes = /*#__PURE__*/function (_React$
|
701
|
-
(0, _inherits2["default"])(Checkboxes, _React$
|
702
|
-
var
|
1103
|
+
var Checkboxes = /*#__PURE__*/function (_React$Component15) {
|
1104
|
+
(0, _inherits2["default"])(Checkboxes, _React$Component15);
|
1105
|
+
var _super15 = _createSuper(Checkboxes);
|
703
1106
|
function Checkboxes(props) {
|
704
|
-
var
|
1107
|
+
var _this19;
|
705
1108
|
(0, _classCallCheck2["default"])(this, Checkboxes);
|
706
|
-
|
707
|
-
|
708
|
-
|
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;
|
709
1124
|
}
|
710
1125
|
(0, _createClass2["default"])(Checkboxes, [{
|
711
1126
|
key: "render",
|
712
1127
|
value: function render() {
|
713
|
-
var
|
1128
|
+
var _this20 = this;
|
714
1129
|
var self = this;
|
715
|
-
var classNames = ''; // 'custom-control custom-checkbox';
|
716
|
-
if (this.props.data.inline) {
|
717
|
-
classNames += ' option-inline';
|
718
|
-
}
|
719
1130
|
var baseClasses = 'SortableItem rfb-item';
|
720
1131
|
if (this.props.data.pageBreakBefore) {
|
721
1132
|
baseClasses += ' alwaysbreak';
|
722
1133
|
}
|
1134
|
+
if (this.props.value) {
|
1135
|
+
this.checkedValues = this.props.value;
|
1136
|
+
}
|
723
1137
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
724
1138
|
style: _objectSpread({}, this.props.style),
|
725
1139
|
className: baseClasses
|
@@ -729,17 +1143,21 @@ var Checkboxes = /*#__PURE__*/function (_React$Component13) {
|
|
729
1143
|
var thisKey = "preview_".concat(option.key);
|
730
1144
|
var props = {};
|
731
1145
|
props.name = "option_".concat(option.key);
|
732
|
-
props.
|
1146
|
+
if (self.props.data.inline) {
|
1147
|
+
props.inline = true;
|
1148
|
+
}
|
733
1149
|
props.value = option.value;
|
734
1150
|
if (self.props.mutable) {
|
735
1151
|
props.defaultChecked = self.props.defaultValue !== undefined && self.props.defaultValue.indexOf(option.key) > -1;
|
736
1152
|
}
|
737
|
-
if (
|
1153
|
+
if (self.props.readOnly) {
|
738
1154
|
props.disabled = 'disabled';
|
739
1155
|
}
|
1156
|
+
if (self.props.value) {
|
1157
|
+
props.checked = _this20.props.value.indexOf(option.value) > -1;
|
1158
|
+
}
|
740
1159
|
return /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Check, (0, _extends2["default"])({
|
741
1160
|
label: option.text,
|
742
|
-
className: classNames,
|
743
1161
|
type: "checkbox",
|
744
1162
|
key: thisKey,
|
745
1163
|
id: "fid_".concat(thisKey),
|
@@ -747,6 +1165,9 @@ var Checkboxes = /*#__PURE__*/function (_React$Component13) {
|
|
747
1165
|
if (c && self.props.mutable) {
|
748
1166
|
self.options["child_ref_".concat(option.key)] = c;
|
749
1167
|
}
|
1168
|
+
},
|
1169
|
+
onChange: function onChange(e) {
|
1170
|
+
self.onCheckboxChange(option.value, e);
|
750
1171
|
}
|
751
1172
|
}, props));
|
752
1173
|
})));
|
@@ -754,22 +1175,20 @@ var Checkboxes = /*#__PURE__*/function (_React$Component13) {
|
|
754
1175
|
}]);
|
755
1176
|
return Checkboxes;
|
756
1177
|
}(_react["default"].Component);
|
757
|
-
var Checkbox = /*#__PURE__*/function (_React$
|
758
|
-
(0, _inherits2["default"])(Checkbox, _React$
|
759
|
-
var
|
1178
|
+
var Checkbox = /*#__PURE__*/function (_React$Component16) {
|
1179
|
+
(0, _inherits2["default"])(Checkbox, _React$Component16);
|
1180
|
+
var _super16 = _createSuper(Checkbox);
|
760
1181
|
function Checkbox(props) {
|
761
|
-
var
|
1182
|
+
var _this21;
|
762
1183
|
(0, _classCallCheck2["default"])(this, Checkbox);
|
763
|
-
|
764
|
-
|
765
|
-
return
|
1184
|
+
_this21 = _super16.call(this, props);
|
1185
|
+
_this21.inputField = /*#__PURE__*/_react["default"].createRef();
|
1186
|
+
return _this21;
|
766
1187
|
}
|
767
1188
|
(0, _createClass2["default"])(Checkbox, [{
|
768
1189
|
key: "render",
|
769
1190
|
value: function render() {
|
770
|
-
var
|
771
|
-
// if (this.props.data.inline) { classNames += ' option-inline'; }
|
772
|
-
|
1191
|
+
var _this22 = this;
|
773
1192
|
var baseClasses = 'SortableItem rfb-item';
|
774
1193
|
if (this.props.data.pageBreakBefore) {
|
775
1194
|
baseClasses += ' alwaysbreak';
|
@@ -782,9 +1201,26 @@ var Checkbox = /*#__PURE__*/function (_React$Component14) {
|
|
782
1201
|
if (this.props.mutable) {
|
783
1202
|
props.ref = this.inputField;
|
784
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
|
+
}
|
785
1218
|
if (this.props.readOnly) {
|
786
1219
|
props.disabled = 'disabled';
|
787
1220
|
}
|
1221
|
+
if (this.props.data.inline) {
|
1222
|
+
props.inline = true;
|
1223
|
+
}
|
788
1224
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
789
1225
|
style: _objectSpread({}, this.props.style),
|
790
1226
|
className: baseClasses
|
@@ -805,25 +1241,20 @@ var Checkbox = /*#__PURE__*/function (_React$Component14) {
|
|
805
1241
|
}]);
|
806
1242
|
return Checkbox;
|
807
1243
|
}(_react["default"].Component);
|
808
|
-
var RadioButtons = /*#__PURE__*/function (_React$
|
809
|
-
(0, _inherits2["default"])(RadioButtons, _React$
|
810
|
-
var
|
1244
|
+
var RadioButtons = /*#__PURE__*/function (_React$Component17) {
|
1245
|
+
(0, _inherits2["default"])(RadioButtons, _React$Component17);
|
1246
|
+
var _super17 = _createSuper(RadioButtons);
|
811
1247
|
function RadioButtons(props) {
|
812
|
-
var
|
1248
|
+
var _this23;
|
813
1249
|
(0, _classCallCheck2["default"])(this, RadioButtons);
|
814
|
-
|
815
|
-
|
816
|
-
return
|
1250
|
+
_this23 = _super17.call(this, props);
|
1251
|
+
_this23.options = {};
|
1252
|
+
return _this23;
|
817
1253
|
}
|
818
1254
|
(0, _createClass2["default"])(RadioButtons, [{
|
819
1255
|
key: "render",
|
820
1256
|
value: function render() {
|
821
|
-
var _this13 = this;
|
822
1257
|
var self = this;
|
823
|
-
var classNames = ''; // 'custom-control custom-radio';
|
824
|
-
if (this.props.data.inline) {
|
825
|
-
classNames += ' option-inline';
|
826
|
-
}
|
827
1258
|
var baseClasses = 'SortableItem rfb-item';
|
828
1259
|
if (this.props.data.pageBreakBefore) {
|
829
1260
|
baseClasses += ' alwaysbreak';
|
@@ -837,17 +1268,26 @@ var RadioButtons = /*#__PURE__*/function (_React$Component15) {
|
|
837
1268
|
var thisKey = "preview_".concat(option.key);
|
838
1269
|
var props = {};
|
839
1270
|
props.name = self.props.data.fieldName;
|
840
|
-
props.type = 'radio';
|
841
1271
|
props.value = option.value;
|
842
1272
|
if (self.props.mutable) {
|
843
|
-
props.defaultChecked = self.props.defaultValue !== undefined &&
|
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
|
+
};
|
1279
|
+
}
|
1280
|
+
if (self.props.value) {
|
1281
|
+
props.checked = self.props.value === option.value;
|
844
1282
|
}
|
845
|
-
if (
|
1283
|
+
if (self.props.readOnly) {
|
846
1284
|
props.disabled = 'disabled';
|
847
1285
|
}
|
1286
|
+
if (self.props.data.inline) {
|
1287
|
+
props.inline = true;
|
1288
|
+
}
|
848
1289
|
return /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Check, (0, _extends2["default"])({
|
849
1290
|
label: option.text,
|
850
|
-
className: classNames,
|
851
1291
|
type: "radio",
|
852
1292
|
key: thisKey,
|
853
1293
|
id: "fid_".concat(thisKey),
|
@@ -862,12 +1302,12 @@ var RadioButtons = /*#__PURE__*/function (_React$Component15) {
|
|
862
1302
|
}]);
|
863
1303
|
return RadioButtons;
|
864
1304
|
}(_react["default"].Component);
|
865
|
-
var Image = /*#__PURE__*/function (_React$
|
866
|
-
(0, _inherits2["default"])(Image, _React$
|
867
|
-
var
|
1305
|
+
var Image = /*#__PURE__*/function (_React$Component18) {
|
1306
|
+
(0, _inherits2["default"])(Image, _React$Component18);
|
1307
|
+
var _super18 = _createSuper(Image);
|
868
1308
|
function Image() {
|
869
1309
|
(0, _classCallCheck2["default"])(this, Image);
|
870
|
-
return
|
1310
|
+
return _super18.apply(this, arguments);
|
871
1311
|
}
|
872
1312
|
(0, _createClass2["default"])(Image, [{
|
873
1313
|
key: "render",
|
@@ -882,7 +1322,7 @@ var Image = /*#__PURE__*/function (_React$Component16) {
|
|
882
1322
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
883
1323
|
style: _objectSpread(_objectSpread({}, this.props.style), style),
|
884
1324
|
className: baseClasses
|
885
|
-
}, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), this.props.data.src && /*#__PURE__*/_react["default"].createElement(
|
1325
|
+
}, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), this.props.data.src && /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Image, {
|
886
1326
|
src: this.props.data.src,
|
887
1327
|
width: this.props.data.width,
|
888
1328
|
height: this.props.data.height
|
@@ -893,19 +1333,20 @@ var Image = /*#__PURE__*/function (_React$Component16) {
|
|
893
1333
|
}]);
|
894
1334
|
return Image;
|
895
1335
|
}(_react["default"].Component);
|
896
|
-
var Rating = /*#__PURE__*/function (_React$
|
897
|
-
(0, _inherits2["default"])(Rating, _React$
|
898
|
-
var
|
1336
|
+
var Rating = /*#__PURE__*/function (_React$Component19) {
|
1337
|
+
(0, _inherits2["default"])(Rating, _React$Component19);
|
1338
|
+
var _super19 = _createSuper(Rating);
|
899
1339
|
function Rating(props) {
|
900
|
-
var
|
1340
|
+
var _this24;
|
901
1341
|
(0, _classCallCheck2["default"])(this, Rating);
|
902
|
-
|
903
|
-
|
904
|
-
return
|
1342
|
+
_this24 = _super19.call(this, props);
|
1343
|
+
_this24.inputField = /*#__PURE__*/_react["default"].createRef();
|
1344
|
+
return _this24;
|
905
1345
|
}
|
906
1346
|
(0, _createClass2["default"])(Rating, [{
|
907
1347
|
key: "render",
|
908
1348
|
value: function render() {
|
1349
|
+
var _this25 = this;
|
909
1350
|
var props = {};
|
910
1351
|
props.name = this.props.data.fieldName;
|
911
1352
|
props.ratingAmount = 5;
|
@@ -915,6 +1356,18 @@ var Rating = /*#__PURE__*/function (_React$Component17) {
|
|
915
1356
|
props.disabled = this.props.readOnly;
|
916
1357
|
props.ref = this.inputField;
|
917
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
|
+
}
|
918
1371
|
var baseClasses = 'SortableItem rfb-item';
|
919
1372
|
if (this.props.data.pageBreakBefore) {
|
920
1373
|
baseClasses += ' alwaysbreak';
|
@@ -929,12 +1382,12 @@ var Rating = /*#__PURE__*/function (_React$Component17) {
|
|
929
1382
|
}]);
|
930
1383
|
return Rating;
|
931
1384
|
}(_react["default"].Component);
|
932
|
-
var HyperLink = /*#__PURE__*/function (_React$
|
933
|
-
(0, _inherits2["default"])(HyperLink, _React$
|
934
|
-
var
|
1385
|
+
var HyperLink = /*#__PURE__*/function (_React$Component20) {
|
1386
|
+
(0, _inherits2["default"])(HyperLink, _React$Component20);
|
1387
|
+
var _super20 = _createSuper(HyperLink);
|
935
1388
|
function HyperLink() {
|
936
1389
|
(0, _classCallCheck2["default"])(this, HyperLink);
|
937
|
-
return
|
1390
|
+
return _super20.apply(this, arguments);
|
938
1391
|
}
|
939
1392
|
(0, _createClass2["default"])(HyperLink, [{
|
940
1393
|
key: "render",
|
@@ -959,12 +1412,12 @@ var HyperLink = /*#__PURE__*/function (_React$Component18) {
|
|
959
1412
|
}]);
|
960
1413
|
return HyperLink;
|
961
1414
|
}(_react["default"].Component);
|
962
|
-
var Download = /*#__PURE__*/function (_React$
|
963
|
-
(0, _inherits2["default"])(Download, _React$
|
964
|
-
var
|
1415
|
+
var Download = /*#__PURE__*/function (_React$Component21) {
|
1416
|
+
(0, _inherits2["default"])(Download, _React$Component21);
|
1417
|
+
var _super21 = _createSuper(Download);
|
965
1418
|
function Download() {
|
966
1419
|
(0, _classCallCheck2["default"])(this, Download);
|
967
|
-
return
|
1420
|
+
return _super21.apply(this, arguments);
|
968
1421
|
}
|
969
1422
|
(0, _createClass2["default"])(Download, [{
|
970
1423
|
key: "render",
|
@@ -985,40 +1438,46 @@ var Download = /*#__PURE__*/function (_React$Component19) {
|
|
985
1438
|
}]);
|
986
1439
|
return Download;
|
987
1440
|
}(_react["default"].Component);
|
988
|
-
var Camera = /*#__PURE__*/function (_React$
|
989
|
-
(0, _inherits2["default"])(Camera, _React$
|
990
|
-
var
|
1441
|
+
var Camera = /*#__PURE__*/function (_React$Component22) {
|
1442
|
+
(0, _inherits2["default"])(Camera, _React$Component22);
|
1443
|
+
var _super22 = _createSuper(Camera);
|
991
1444
|
function Camera(props) {
|
992
|
-
var
|
1445
|
+
var _this26;
|
993
1446
|
(0, _classCallCheck2["default"])(this, Camera);
|
994
|
-
|
995
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
996
|
-
var self = (0, _assertThisInitialized2["default"])(
|
1447
|
+
_this26 = _super22.call(this, props);
|
1448
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this26), "displayImage", function (e) {
|
1449
|
+
var self = (0, _assertThisInitialized2["default"])(_this26);
|
997
1450
|
var target = e.target;
|
998
1451
|
if (target.files && target.files.length) {
|
999
1452
|
self.setState({
|
1000
1453
|
img: target.files[0],
|
1001
1454
|
previewImg: URL.createObjectURL(target.files[0])
|
1002
1455
|
});
|
1456
|
+
if (_this26.props.onChange) {
|
1457
|
+
_this26.props.onChange(target.files[0]);
|
1458
|
+
}
|
1003
1459
|
}
|
1004
1460
|
});
|
1005
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
1006
|
-
|
1461
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this26), "clearImage", function (e) {
|
1462
|
+
_this26.setState({
|
1007
1463
|
img: null,
|
1008
1464
|
previewImg: null
|
1009
1465
|
});
|
1466
|
+
if (_this26.props.onChange) {
|
1467
|
+
_this26.props.onChange(null);
|
1468
|
+
}
|
1010
1469
|
});
|
1011
|
-
|
1470
|
+
_this26.state = {
|
1012
1471
|
img: null,
|
1013
1472
|
previewImg: null
|
1014
1473
|
};
|
1015
|
-
return
|
1474
|
+
return _this26;
|
1016
1475
|
}
|
1017
1476
|
(0, _createClass2["default"])(Camera, [{
|
1018
1477
|
key: "getImageSizeProps",
|
1019
|
-
value: function getImageSizeProps(
|
1020
|
-
var width =
|
1021
|
-
height =
|
1478
|
+
value: function getImageSizeProps(_ref4) {
|
1479
|
+
var width = _ref4.width,
|
1480
|
+
height = _ref4.height;
|
1022
1481
|
var imgProps = {
|
1023
1482
|
width: '100%'
|
1024
1483
|
};
|
@@ -1033,7 +1492,7 @@ var Camera = /*#__PURE__*/function (_React$Component20) {
|
|
1033
1492
|
}, {
|
1034
1493
|
key: "render",
|
1035
1494
|
value: function render() {
|
1036
|
-
var
|
1495
|
+
var _this27 = this;
|
1037
1496
|
var imageStyle = {
|
1038
1497
|
objectFit: 'scale-down',
|
1039
1498
|
objectPosition: this.props.data.center ? 'center' : 'left'
|
@@ -1054,12 +1513,15 @@ var Camera = /*#__PURE__*/function (_React$Component20) {
|
|
1054
1513
|
sourceDataURL = "data:image/png;base64,".concat(this.props.defaultValue);
|
1055
1514
|
}
|
1056
1515
|
}
|
1516
|
+
if (this.props.value) {
|
1517
|
+
sourceDataURL = this.props.value;
|
1518
|
+
}
|
1057
1519
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
1058
1520
|
style: _objectSpread({}, this.props.style),
|
1059
1521
|
className: baseClasses
|
1060
1522
|
}, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
|
1061
1523
|
className: "form-group mb-3"
|
1062
|
-
}, /*#__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(
|
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"])({
|
1063
1525
|
style: imageStyle,
|
1064
1526
|
src: sourceDataURL
|
1065
1527
|
}, this.getImageSizeProps(this.props.data)))) : /*#__PURE__*/_react["default"].createElement("div", {
|
@@ -1077,14 +1539,16 @@ var Camera = /*#__PURE__*/function (_React$Component20) {
|
|
1077
1539
|
className: "image-upload-control"
|
1078
1540
|
}, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Button, {
|
1079
1541
|
variant: "light"
|
1080
|
-
}, /*#__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(
|
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, {
|
1081
1543
|
onLoad: function onLoad() {
|
1082
|
-
return URL.revokeObjectURL(
|
1544
|
+
return URL.revokeObjectURL(_this27.state.previewImg);
|
1083
1545
|
},
|
1084
1546
|
src: this.state.previewImg,
|
1085
1547
|
height: "100",
|
1086
1548
|
className: "image-upload-preview"
|
1087
1549
|
}), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Button, {
|
1550
|
+
variant: "default",
|
1551
|
+
size: "sm",
|
1088
1552
|
className: "btn-image-clear",
|
1089
1553
|
onClick: this.clearImage
|
1090
1554
|
}, /*#__PURE__*/_react["default"].createElement(_fa.FaTimes, null), " Clear Photo")))));
|
@@ -1092,15 +1556,15 @@ var Camera = /*#__PURE__*/function (_React$Component20) {
|
|
1092
1556
|
}]);
|
1093
1557
|
return Camera;
|
1094
1558
|
}(_react["default"].Component);
|
1095
|
-
var FileUpload = /*#__PURE__*/function (_React$
|
1096
|
-
(0, _inherits2["default"])(FileUpload, _React$
|
1097
|
-
var
|
1559
|
+
var FileUpload = /*#__PURE__*/function (_React$Component23) {
|
1560
|
+
(0, _inherits2["default"])(FileUpload, _React$Component23);
|
1561
|
+
var _super23 = _createSuper(FileUpload);
|
1098
1562
|
function FileUpload(props) {
|
1099
|
-
var
|
1563
|
+
var _this28;
|
1100
1564
|
(0, _classCallCheck2["default"])(this, FileUpload);
|
1101
|
-
|
1102
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
1103
|
-
var self = (0, _assertThisInitialized2["default"])(
|
1565
|
+
_this28 = _super23.call(this, props);
|
1566
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this28), "displayFileUpload", function (e) {
|
1567
|
+
var self = (0, _assertThisInitialized2["default"])(_this28);
|
1104
1568
|
var target = e.target;
|
1105
1569
|
var file;
|
1106
1570
|
if (target.files && target.files.length > 0) {
|
@@ -1108,21 +1572,27 @@ var FileUpload = /*#__PURE__*/function (_React$Component21) {
|
|
1108
1572
|
self.setState({
|
1109
1573
|
fileUpload: file
|
1110
1574
|
});
|
1575
|
+
if (_this28.props.onChange) {
|
1576
|
+
_this28.props.onChange(file);
|
1577
|
+
}
|
1111
1578
|
}
|
1112
1579
|
});
|
1113
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
1114
|
-
|
1580
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this28), "clearFileUpload", function () {
|
1581
|
+
_this28.setState({
|
1115
1582
|
fileUpload: null
|
1116
1583
|
});
|
1584
|
+
if (_this28.props.onChange) {
|
1585
|
+
_this28.props.onChange(null);
|
1586
|
+
}
|
1117
1587
|
});
|
1118
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
1119
|
-
var
|
1588
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this28), "saveFile", /*#__PURE__*/function () {
|
1589
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(e) {
|
1120
1590
|
var sourceUrl, response, dispositionHeader, resBlob, blob, fileName, _fileName;
|
1121
1591
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
1122
1592
|
while (1) switch (_context.prev = _context.next) {
|
1123
1593
|
case 0:
|
1124
1594
|
e.preventDefault();
|
1125
|
-
sourceUrl =
|
1595
|
+
sourceUrl = _this28.props.defaultValue;
|
1126
1596
|
_context.next = 4;
|
1127
1597
|
return (0, _isomorphicFetch["default"])(sourceUrl, {
|
1128
1598
|
method: 'GET',
|
@@ -1141,7 +1611,7 @@ var FileUpload = /*#__PURE__*/function (_React$Component21) {
|
|
1141
1611
|
resBlob = _context.sent;
|
1142
1612
|
// eslint-disable-next-line no-undef
|
1143
1613
|
blob = new Blob([resBlob], {
|
1144
|
-
type:
|
1614
|
+
type: _this28.props.data.fileType || response.headers.get('Content-Type')
|
1145
1615
|
});
|
1146
1616
|
if (dispositionHeader && dispositionHeader.indexOf(';filename=') > -1) {
|
1147
1617
|
fileName = dispositionHeader.split(';filename=')[1];
|
@@ -1157,13 +1627,13 @@ var FileUpload = /*#__PURE__*/function (_React$Component21) {
|
|
1157
1627
|
}, _callee);
|
1158
1628
|
}));
|
1159
1629
|
return function (_x) {
|
1160
|
-
return
|
1630
|
+
return _ref5.apply(this, arguments);
|
1161
1631
|
};
|
1162
1632
|
}());
|
1163
|
-
|
1633
|
+
_this28.state = {
|
1164
1634
|
fileUpload: null
|
1165
1635
|
};
|
1166
|
-
return
|
1636
|
+
return _this28;
|
1167
1637
|
}
|
1168
1638
|
(0, _createClass2["default"])(FileUpload, [{
|
1169
1639
|
key: "render",
|
@@ -1211,6 +1681,8 @@ var FileUpload = /*#__PURE__*/function (_React$Component21) {
|
|
1211
1681
|
marginLeft: '5px'
|
1212
1682
|
}
|
1213
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",
|
1214
1686
|
className: "btn-file-upload-clear",
|
1215
1687
|
onClick: this.clearFileUpload
|
1216
1688
|
}, /*#__PURE__*/_react["default"].createElement(_fa.FaTimes, null), " Clear File")))));
|
@@ -1218,24 +1690,27 @@ var FileUpload = /*#__PURE__*/function (_React$Component21) {
|
|
1218
1690
|
}]);
|
1219
1691
|
return FileUpload;
|
1220
1692
|
}(_react["default"].Component);
|
1221
|
-
var Range = /*#__PURE__*/function (_React$
|
1222
|
-
(0, _inherits2["default"])(Range, _React$
|
1223
|
-
var
|
1693
|
+
var Range = /*#__PURE__*/function (_React$Component24) {
|
1694
|
+
(0, _inherits2["default"])(Range, _React$Component24);
|
1695
|
+
var _super24 = _createSuper(Range);
|
1224
1696
|
function Range(props) {
|
1225
|
-
var
|
1697
|
+
var _this29;
|
1226
1698
|
(0, _classCallCheck2["default"])(this, Range);
|
1227
|
-
|
1228
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
1699
|
+
_this29 = _super24.call(this, props);
|
1700
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this29), "changeValue", function (e) {
|
1229
1701
|
var target = e.target;
|
1230
|
-
|
1702
|
+
_this29.setState({
|
1231
1703
|
value: target.value
|
1232
1704
|
});
|
1705
|
+
if (_this29.props.onChange) {
|
1706
|
+
_this29.props.onChange(target.value);
|
1707
|
+
}
|
1233
1708
|
});
|
1234
|
-
|
1235
|
-
|
1709
|
+
_this29.inputField = /*#__PURE__*/_react["default"].createRef();
|
1710
|
+
_this29.state = {
|
1236
1711
|
value: props.defaultValue !== undefined ? parseInt(props.defaultValue, 10) : parseInt(props.data.defaultValue, 10)
|
1237
1712
|
};
|
1238
|
-
return
|
1713
|
+
return _this29;
|
1239
1714
|
}
|
1240
1715
|
(0, _createClass2["default"])(Range, [{
|
1241
1716
|
key: "render",
|
@@ -1326,7 +1801,7 @@ SurveyElements.Dropdown = Dropdown;
|
|
1326
1801
|
SurveyElements.Signature = Signature;
|
1327
1802
|
SurveyElements.Checkboxes = Checkboxes;
|
1328
1803
|
SurveyElements.Checkbox = Checkbox;
|
1329
|
-
SurveyElements.DatePicker =
|
1804
|
+
SurveyElements.DatePicker = DatePicker;
|
1330
1805
|
SurveyElements.RadioButtons = RadioButtons;
|
1331
1806
|
SurveyElements.Image = Image;
|
1332
1807
|
SurveyElements.Rating = Rating;
|