react-survey-builder 1.0.68 → 1.0.70
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/dist/bundle.js +3 -3
- package/lib/form-fields.js +34 -132
- package/lib/form.js +33 -129
- package/lib/survey-elements/index.js +302 -250
- package/package.json +1 -1
@@ -5,7 +5,8 @@ var _excluded = ["name", "onChange", "value", "style", "item"],
|
|
5
5
|
_excluded4 = ["name", "onChange", "value", "style", "item"],
|
6
6
|
_excluded5 = ["name", "onChange", "value", "style", "item"],
|
7
7
|
_excluded6 = ["name", "onChange", "value", "style", "item"],
|
8
|
-
_excluded7 = ["name", "onChange", "value", "style", "item"]
|
8
|
+
_excluded7 = ["name", "onChange", "value", "style", "item"],
|
9
|
+
_excluded8 = ["name", "onChange", "value", "style", "item"];
|
9
10
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
10
11
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
11
12
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
@@ -517,12 +518,12 @@ export var PhoneNumber = function PhoneNumber(_ref5) {
|
|
517
518
|
var _item$required7, _item$disabled5, _item$required8;
|
518
519
|
var name = _ref5.name,
|
519
520
|
onChange = _ref5.onChange,
|
520
|
-
value = _ref5.value,
|
521
|
+
_ref5$value = _ref5.value,
|
522
|
+
value = _ref5$value === void 0 ? '' : _ref5$value,
|
521
523
|
style = _ref5.style,
|
522
524
|
item = _ref5.item,
|
523
525
|
props = _objectWithoutProperties(_ref5, _excluded3);
|
524
526
|
var methods = useFormContext();
|
525
|
-
var inputField = React.useRef(null);
|
526
527
|
var onChangeHandler = function onChangeHandler(value) {
|
527
528
|
if (onChange !== undefined) {
|
528
529
|
onChange(value);
|
@@ -546,13 +547,17 @@ export var PhoneNumber = function PhoneNumber(_ref5) {
|
|
546
547
|
return '';
|
547
548
|
}
|
548
549
|
};
|
550
|
+
var validatePhoneNumber = function validatePhoneNumber(value) {
|
551
|
+
if (value !== undefined && value !== null && value !== '') {
|
552
|
+
return isValidPhoneNumber(toE164PhoneNumber(value), 'US');
|
553
|
+
}
|
554
|
+
return true;
|
555
|
+
};
|
549
556
|
var inputProps = {
|
550
557
|
type: 'text',
|
551
558
|
required: (_item$required7 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required7 !== void 0 ? _item$required7 : false,
|
552
559
|
disabled: (_item$disabled5 = item === null || item === void 0 ? void 0 : item.disabled) !== null && _item$disabled5 !== void 0 ? _item$disabled5 : false,
|
553
|
-
autoComplete: 'new-password'
|
554
|
-
// hack to prevent auto-complete for form fields
|
555
|
-
formatMask: (item === null || item === void 0 ? void 0 : item.formatMask) || 'MM/DD/YYYY'
|
560
|
+
autoComplete: 'new-password' // hack to prevent auto-complete for form fields
|
556
561
|
};
|
557
562
|
if (item !== null && item !== void 0 && item.label) {
|
558
563
|
inputProps.label = item === null || item === void 0 ? void 0 : item.label;
|
@@ -562,22 +567,14 @@ export var PhoneNumber = function PhoneNumber(_ref5) {
|
|
562
567
|
} else if (item !== null && item !== void 0 && item.label) {
|
563
568
|
inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
|
564
569
|
}
|
565
|
-
if (item !== null && item !== void 0 && item.mutable) {
|
566
|
-
inputProps.ref = inputField;
|
567
|
-
}
|
568
570
|
var fieldRules = {
|
569
571
|
validate: function validate(value) {
|
570
|
-
return
|
572
|
+
return validatePhoneNumber(value) || "".concat(item === null || item === void 0 ? void 0 : item.label, " field requires a valid phone number");
|
571
573
|
}
|
572
574
|
};
|
573
575
|
if ((_item$required8 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required8 !== void 0 ? _item$required8 : false) {
|
574
576
|
fieldRules.required = 'Required Field';
|
575
577
|
}
|
576
|
-
|
577
|
-
// if (CustomPhoneInput !== undefined) {
|
578
|
-
// inputProps.as = CustomPhoneInput;
|
579
|
-
// }
|
580
|
-
|
581
578
|
var controllerProps = {
|
582
579
|
name: name,
|
583
580
|
rules: fieldRules
|
@@ -686,7 +683,6 @@ export var PhoneNumber = function PhoneNumber(_ref5) {
|
|
686
683
|
}, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Form.Control, _extends({
|
687
684
|
value: value,
|
688
685
|
name: name,
|
689
|
-
ref: inputField,
|
690
686
|
id: name + '-' + ID.uuid()
|
691
687
|
}, inputProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
|
692
688
|
item: item,
|
@@ -699,7 +695,6 @@ export var PhoneNumber = function PhoneNumber(_ref5) {
|
|
699
695
|
}), /*#__PURE__*/React.createElement(Form.Control, _extends({
|
700
696
|
value: value,
|
701
697
|
name: name,
|
702
|
-
ref: inputField,
|
703
698
|
id: name + '-' + ID.uuid()
|
704
699
|
}, inputProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
|
705
700
|
muted: true
|
@@ -753,7 +748,6 @@ export var DatePicker = function DatePicker(_ref8) {
|
|
753
748
|
item = _ref8.item,
|
754
749
|
props = _objectWithoutProperties(_ref8, _excluded4);
|
755
750
|
var methods = useFormContext();
|
756
|
-
var inputField = React.useRef(null);
|
757
751
|
var onChangeHandler = function onChangeHandler(value) {
|
758
752
|
if (onChange !== undefined) {
|
759
753
|
onChange(value);
|
@@ -811,9 +805,7 @@ export var DatePicker = function DatePicker(_ref8) {
|
|
811
805
|
type: 'text',
|
812
806
|
required: (_item$required10 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required10 !== void 0 ? _item$required10 : false,
|
813
807
|
disabled: (_item$disabled7 = item === null || item === void 0 ? void 0 : item.disabled) !== null && _item$disabled7 !== void 0 ? _item$disabled7 : false,
|
814
|
-
autoComplete: 'new-password'
|
815
|
-
// hack to prevent auto-complete for form fields
|
816
|
-
formatMask: (item === null || item === void 0 ? void 0 : item.formatMask) || 'MM/DD/YYYY'
|
808
|
+
autoComplete: 'new-password' // hack to prevent auto-complete for form fields
|
817
809
|
};
|
818
810
|
if (item !== null && item !== void 0 && item.label) {
|
819
811
|
inputProps.label = item === null || item === void 0 ? void 0 : item.label;
|
@@ -823,9 +815,6 @@ export var DatePicker = function DatePicker(_ref8) {
|
|
823
815
|
} else if (item !== null && item !== void 0 && item.label) {
|
824
816
|
inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
|
825
817
|
}
|
826
|
-
if (item !== null && item !== void 0 && item.mutable) {
|
827
|
-
inputProps.ref = inputField;
|
828
|
-
}
|
829
818
|
var fieldRules = {
|
830
819
|
validate: function validate(value) {
|
831
820
|
return validateDate(value) || 'Please enter a valid Date in the format MM/DD/YYYY';
|
@@ -834,20 +823,12 @@ export var DatePicker = function DatePicker(_ref8) {
|
|
834
823
|
if ((_item$required11 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required11 !== void 0 ? _item$required11 : false) {
|
835
824
|
fieldRules.required = 'Required Field';
|
836
825
|
}
|
837
|
-
|
838
|
-
// if (CustomDateInput !== undefined) {
|
839
|
-
// inputProps.as = CustomDateInput;
|
840
|
-
// }
|
841
|
-
|
842
826
|
var controllerProps = {
|
843
827
|
name: name,
|
844
828
|
rules: fieldRules
|
845
829
|
};
|
846
|
-
console.log('inputProps', inputProps);
|
847
|
-
console.log('iMaskInput', IMaskInput);
|
848
830
|
if (IMaskInput !== undefined && IMask !== undefined) {
|
849
831
|
controllerProps.render = function (_ref9) {
|
850
|
-
var _inputProps$formatMas;
|
851
832
|
var _ref9$field = _ref9.field,
|
852
833
|
onChange = _ref9$field.onChange,
|
853
834
|
onBlur = _ref9$field.onBlur,
|
@@ -869,7 +850,7 @@ export var DatePicker = function DatePicker(_ref8) {
|
|
869
850
|
mask: Date,
|
870
851
|
lazy: false,
|
871
852
|
overwrite: true,
|
872
|
-
pattern:
|
853
|
+
pattern: 'MM/DD/YYYY',
|
873
854
|
format: function format(date) {
|
874
855
|
var day = date.getDate();
|
875
856
|
var month = date.getMonth() + 1;
|
@@ -975,7 +956,9 @@ export var DatePicker = function DatePicker(_ref8) {
|
|
975
956
|
if (item !== null && item !== void 0 && item.pageBreakBefore) {
|
976
957
|
baseClasses += ' alwaysbreak';
|
977
958
|
}
|
978
|
-
|
959
|
+
|
960
|
+
// console.log('controllerProps', controllerProps);
|
961
|
+
|
979
962
|
if (!methods) {
|
980
963
|
return /*#__PURE__*/React.createElement("div", {
|
981
964
|
style: _objectSpread({}, style),
|
@@ -987,7 +970,6 @@ export var DatePicker = function DatePicker(_ref8) {
|
|
987
970
|
}, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Form.Control, _extends({
|
988
971
|
value: value,
|
989
972
|
name: name,
|
990
|
-
ref: inputField,
|
991
973
|
id: name + '-' + ID.uuid()
|
992
974
|
}, inputProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
|
993
975
|
item: item,
|
@@ -1000,7 +982,6 @@ export var DatePicker = function DatePicker(_ref8) {
|
|
1000
982
|
}), /*#__PURE__*/React.createElement(Form.Control, _extends({
|
1001
983
|
value: value,
|
1002
984
|
name: name,
|
1003
|
-
ref: inputField,
|
1004
985
|
id: name + '-' + ID.uuid()
|
1005
986
|
}, inputProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
|
1006
987
|
muted: true
|
@@ -1054,7 +1035,6 @@ export var NumberInput = function NumberInput(_ref11) {
|
|
1054
1035
|
item = _ref11.item,
|
1055
1036
|
props = _objectWithoutProperties(_ref11, _excluded5);
|
1056
1037
|
var methods = useFormContext();
|
1057
|
-
var inputField = React.useRef(null);
|
1058
1038
|
var onChangeHandler = function onChangeHandler(value) {
|
1059
1039
|
if (onChange !== undefined) {
|
1060
1040
|
onChange(value);
|
@@ -1074,9 +1054,6 @@ export var NumberInput = function NumberInput(_ref11) {
|
|
1074
1054
|
} else if (item !== null && item !== void 0 && item.label) {
|
1075
1055
|
inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
|
1076
1056
|
}
|
1077
|
-
if (item !== null && item !== void 0 && item.mutable) {
|
1078
|
-
inputProps.ref = inputField;
|
1079
|
-
}
|
1080
1057
|
var fieldRules = {};
|
1081
1058
|
if ((_item$required14 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required14 !== void 0 ? _item$required14 : false) {
|
1082
1059
|
fieldRules.required = 'Required Field';
|
@@ -1141,7 +1118,6 @@ export var NumberInput = function NumberInput(_ref11) {
|
|
1141
1118
|
}, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Form.Control, _extends({
|
1142
1119
|
value: value,
|
1143
1120
|
name: name,
|
1144
|
-
ref: inputField,
|
1145
1121
|
id: name + '-2-' + ID.uuid()
|
1146
1122
|
}, inputProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
|
1147
1123
|
item: item,
|
@@ -1154,7 +1130,6 @@ export var NumberInput = function NumberInput(_ref11) {
|
|
1154
1130
|
}), /*#__PURE__*/React.createElement(Form.Control, _extends({
|
1155
1131
|
value: value,
|
1156
1132
|
name: name,
|
1157
|
-
ref: inputField,
|
1158
1133
|
id: name + '-2-' + ID.uuid()
|
1159
1134
|
}, inputProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
|
1160
1135
|
muted: true
|
@@ -1208,7 +1183,6 @@ export var TextArea = function TextArea(_ref13) {
|
|
1208
1183
|
item = _ref13.item,
|
1209
1184
|
props = _objectWithoutProperties(_ref13, _excluded6);
|
1210
1185
|
var methods = useFormContext();
|
1211
|
-
var inputField = React.useRef(null);
|
1212
1186
|
var onChangeHandler = function onChangeHandler(value) {
|
1213
1187
|
if (onChange !== undefined) {
|
1214
1188
|
onChange(value);
|
@@ -1228,9 +1202,6 @@ export var TextArea = function TextArea(_ref13) {
|
|
1228
1202
|
} else if (item !== null && item !== void 0 && item.label) {
|
1229
1203
|
inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
|
1230
1204
|
}
|
1231
|
-
if (item !== null && item !== void 0 && item.mutable) {
|
1232
|
-
inputProps.ref = inputField;
|
1233
|
-
}
|
1234
1205
|
var fieldRules = {};
|
1235
1206
|
if ((_item$required17 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required17 !== void 0 ? _item$required17 : false) {
|
1236
1207
|
fieldRules.required = 'Required Field';
|
@@ -1296,7 +1267,6 @@ export var TextArea = function TextArea(_ref13) {
|
|
1296
1267
|
}, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Form.Control, _extends({
|
1297
1268
|
value: value,
|
1298
1269
|
name: name,
|
1299
|
-
ref: inputField,
|
1300
1270
|
id: name + '-2-' + ID.uuid(),
|
1301
1271
|
as: "textarea"
|
1302
1272
|
}, inputProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
|
@@ -1310,7 +1280,6 @@ export var TextArea = function TextArea(_ref13) {
|
|
1310
1280
|
}), /*#__PURE__*/React.createElement(Form.Control, _extends({
|
1311
1281
|
value: value,
|
1312
1282
|
name: name,
|
1313
|
-
ref: inputField,
|
1314
1283
|
id: name + '-2-' + ID.uuid(),
|
1315
1284
|
as: "textarea"
|
1316
1285
|
}, inputProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
|
@@ -1365,7 +1334,6 @@ export var Dropdown = function Dropdown(_ref15) {
|
|
1365
1334
|
item = _ref15.item,
|
1366
1335
|
props = _objectWithoutProperties(_ref15, _excluded7);
|
1367
1336
|
var methods = useFormContext();
|
1368
|
-
var inputField = React.useRef(null);
|
1369
1337
|
var onChangeHandler = function onChangeHandler(value) {
|
1370
1338
|
if (onChange !== undefined) {
|
1371
1339
|
onChange(value);
|
@@ -1385,9 +1353,6 @@ export var Dropdown = function Dropdown(_ref15) {
|
|
1385
1353
|
} else if (item !== null && item !== void 0 && item.label) {
|
1386
1354
|
inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
|
1387
1355
|
}
|
1388
|
-
if (item !== null && item !== void 0 && item.mutable) {
|
1389
|
-
inputProps.ref = inputField;
|
1390
|
-
}
|
1391
1356
|
var fieldRules = {};
|
1392
1357
|
if ((_item$required20 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required20 !== void 0 ? _item$required20 : false) {
|
1393
1358
|
fieldRules.required = 'Required Field';
|
@@ -1460,8 +1425,7 @@ export var Dropdown = function Dropdown(_ref15) {
|
|
1460
1425
|
}, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Form.Select, _extends({
|
1461
1426
|
id: name + '-' + ID.uuid(),
|
1462
1427
|
value: value,
|
1463
|
-
name: name
|
1464
|
-
ref: inputField
|
1428
|
+
name: name
|
1465
1429
|
}, inputProps), inputProps.placeholder ? /*#__PURE__*/React.createElement("option", {
|
1466
1430
|
value: ""
|
1467
1431
|
}, inputProps.placeholder) : null, item === null || item === void 0 ? void 0 : item.options.map(function (option) {
|
@@ -1481,8 +1445,7 @@ export var Dropdown = function Dropdown(_ref15) {
|
|
1481
1445
|
}), /*#__PURE__*/React.createElement(Form.Select, _extends({
|
1482
1446
|
id: name + '-' + ID.uuid(),
|
1483
1447
|
value: value,
|
1484
|
-
name: name
|
1485
|
-
ref: inputField
|
1448
|
+
name: name
|
1486
1449
|
}, inputProps), inputProps.placeholder ? /*#__PURE__*/React.createElement("option", {
|
1487
1450
|
value: ""
|
1488
1451
|
}, inputProps.placeholder) : null, item === null || item === void 0 ? void 0 : item.options.map(function (option) {
|
@@ -1724,134 +1687,223 @@ export var Signature = /*#__PURE__*/function (_React$Component6) {
|
|
1724
1687
|
}
|
1725
1688
|
}]);
|
1726
1689
|
}(React.Component);
|
1727
|
-
export var Tags =
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
if (val) {
|
1740
|
-
return options.filter(function (option) {
|
1741
|
-
return val.indexOf(option.value) > -1;
|
1742
|
-
});
|
1743
|
-
}
|
1744
|
-
return [];
|
1690
|
+
export var Tags = function Tags(_ref18) {
|
1691
|
+
var _item$required22, _item$disabled15, _item$required23;
|
1692
|
+
var name = _ref18.name,
|
1693
|
+
onChange = _ref18.onChange,
|
1694
|
+
value = _ref18.value,
|
1695
|
+
style = _ref18.style,
|
1696
|
+
item = _ref18.item,
|
1697
|
+
props = _objectWithoutProperties(_ref18, _excluded8);
|
1698
|
+
var methods = useFormContext();
|
1699
|
+
var onChangeHandler = function onChangeHandler(value) {
|
1700
|
+
if (onChange !== undefined) {
|
1701
|
+
onChange(value);
|
1745
1702
|
}
|
1746
|
-
}
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
return {
|
1752
|
-
value: option.value,
|
1753
|
-
label: option.text,
|
1754
|
-
key: option.value
|
1755
|
-
};
|
1703
|
+
};
|
1704
|
+
var getDefaultValue = function getDefaultValue(val, options) {
|
1705
|
+
if (val) {
|
1706
|
+
return options.filter(function (option) {
|
1707
|
+
return val.indexOf(option.value) > -1;
|
1756
1708
|
});
|
1757
|
-
var props = {};
|
1758
|
-
props.name = this.props.name;
|
1759
|
-
props.placeholder = this.props.item.placeholder || 'Select...';
|
1760
|
-
props.onChange = function (val) {
|
1761
|
-
_this4.props.onChange(val !== undefined && val !== null && val.length > 0 ? val.map(function (i) {
|
1762
|
-
return i.value;
|
1763
|
-
}) : []);
|
1764
|
-
};
|
1765
|
-
props.isInvalid = this.props.isInvalid;
|
1766
|
-
if (this.props.onBlur) {
|
1767
|
-
props.onBlur = this.props.onBlur;
|
1768
|
-
}
|
1769
|
-
props.autoComplete = "new-password";
|
1770
|
-
if (this.props.item.disabled) {
|
1771
|
-
props.disabled = 'disabled';
|
1772
|
-
}
|
1773
|
-
if (this.props.item.mutable) {
|
1774
|
-
props.ref = this.inputField;
|
1775
|
-
}
|
1776
|
-
props.multiple = true;
|
1777
|
-
props.selected = this.getDefaultValue(this.props.value, options);
|
1778
|
-
props.options = options;
|
1779
|
-
// props.required = this.props.item.required;
|
1780
|
-
|
1781
|
-
var baseClasses = 'SortableItem rfb-item';
|
1782
|
-
if (this.props.item.pageBreakBefore) {
|
1783
|
-
baseClasses += ' alwaysbreak';
|
1784
|
-
}
|
1785
|
-
var labelLocation = 'ABOVE';
|
1786
|
-
if (this.props.item.labelLocation) {
|
1787
|
-
labelLocation = this.props.item.labelLocation;
|
1788
|
-
}
|
1789
|
-
if (this.props.item.print === true) {
|
1790
|
-
return /*#__PURE__*/React.createElement("div", {
|
1791
|
-
style: _objectSpread({}, this.props.style),
|
1792
|
-
className: baseClasses
|
1793
|
-
}, /*#__PURE__*/React.createElement(Form.Group, {
|
1794
|
-
className: "form-group mb-3"
|
1795
|
-
}, /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
|
1796
|
-
htmlFor: props.name
|
1797
|
-
})), /*#__PURE__*/React.createElement("div", null, this.props.item.options.filter(function (option) {
|
1798
|
-
return _this4.props.value.includes(option.value);
|
1799
|
-
}).map(function (option) {
|
1800
|
-
return option.text;
|
1801
|
-
}).join(', '))));
|
1802
|
-
}
|
1803
|
-
return /*#__PURE__*/React.createElement("div", {
|
1804
|
-
style: _objectSpread({}, this.props.style),
|
1805
|
-
className: baseClasses
|
1806
|
-
}, /*#__PURE__*/React.createElement(ComponentHeader, this.props), /*#__PURE__*/React.createElement(Form.Group, {
|
1807
|
-
className: "form-group mb-3"
|
1808
|
-
}, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Typeahead, _extends({
|
1809
|
-
labelKey: function labelKey(option) {
|
1810
|
-
return option.label;
|
1811
|
-
},
|
1812
|
-
id: props.name + '-' + ID.uuid()
|
1813
|
-
}, props)), /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
|
1814
|
-
htmlFor: props.name
|
1815
|
-
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
|
1816
|
-
htmlFor: props.name
|
1817
|
-
})), /*#__PURE__*/React.createElement(Typeahead, _extends({
|
1818
|
-
labelKey: function labelKey(option) {
|
1819
|
-
return option.label;
|
1820
|
-
},
|
1821
|
-
id: props.name + '-' + ID.uuid()
|
1822
|
-
}, props))), this.props.item.help ? /*#__PURE__*/React.createElement(Form.Text, {
|
1823
|
-
muted: true
|
1824
|
-
}, this.props.item.help) : null, /*#__PURE__*/React.createElement(ComponentErrorMessage, {
|
1825
|
-
name: props.name
|
1826
|
-
})));
|
1827
1709
|
}
|
1828
|
-
|
1829
|
-
}
|
1830
|
-
|
1710
|
+
return [];
|
1711
|
+
};
|
1712
|
+
var options = item === null || item === void 0 ? void 0 : item.options.map(function (option) {
|
1713
|
+
return {
|
1714
|
+
value: option.value,
|
1715
|
+
label: option.text,
|
1716
|
+
key: option.value
|
1717
|
+
};
|
1718
|
+
});
|
1719
|
+
var inputProps = {
|
1720
|
+
multiple: true,
|
1721
|
+
required: (_item$required22 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required22 !== void 0 ? _item$required22 : false,
|
1722
|
+
disabled: (_item$disabled15 = item === null || item === void 0 ? void 0 : item.disabled) !== null && _item$disabled15 !== void 0 ? _item$disabled15 : false,
|
1723
|
+
autoComplete: 'new-password' // hack to prevent auto-complete for form fields
|
1724
|
+
};
|
1725
|
+
if (item !== null && item !== void 0 && item.label) {
|
1726
|
+
inputProps.label = item === null || item === void 0 ? void 0 : item.label;
|
1727
|
+
}
|
1728
|
+
if (item !== null && item !== void 0 && item.placeholder) {
|
1729
|
+
inputProps.placeholder = item === null || item === void 0 ? void 0 : item.placeholder;
|
1730
|
+
} else if (item !== null && item !== void 0 && item.label) {
|
1731
|
+
inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
|
1732
|
+
} else {
|
1733
|
+
inputProps.placeholder = 'Select...';
|
1734
|
+
}
|
1735
|
+
var fieldRules = {};
|
1736
|
+
if ((_item$required23 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required23 !== void 0 ? _item$required23 : false) {
|
1737
|
+
fieldRules.required = 'Required Field';
|
1738
|
+
}
|
1739
|
+
var controllerProps = {
|
1740
|
+
name: name,
|
1741
|
+
rules: fieldRules
|
1742
|
+
};
|
1743
|
+
controllerProps.render = function (_ref19) {
|
1744
|
+
var _ref19$field = _ref19.field,
|
1745
|
+
_onChange8 = _ref19$field.onChange,
|
1746
|
+
onBlur = _ref19$field.onBlur,
|
1747
|
+
value = _ref19$field.value,
|
1748
|
+
name = _ref19$field.name,
|
1749
|
+
ref = _ref19$field.ref,
|
1750
|
+
_ref19$fieldState = _ref19.fieldState,
|
1751
|
+
invalid = _ref19$fieldState.invalid,
|
1752
|
+
isTouched = _ref19$fieldState.isTouched,
|
1753
|
+
isDirty = _ref19$fieldState.isDirty,
|
1754
|
+
error = _ref19$fieldState.error,
|
1755
|
+
formState = _ref19.formState;
|
1756
|
+
return /*#__PURE__*/React.createElement(Typeahead, _extends({
|
1757
|
+
labelKey: function labelKey(option) {
|
1758
|
+
return option.label;
|
1759
|
+
},
|
1760
|
+
onBlur: onBlur,
|
1761
|
+
onChange: function onChange(selected) {
|
1762
|
+
// console.log(selected);
|
1763
|
+
if (selected.length >= 1) {
|
1764
|
+
//console.log(selected[0]);
|
1765
|
+
_onChange8(selected.map(function (i) {
|
1766
|
+
return i.value;
|
1767
|
+
}));
|
1768
|
+
onChangeHandler(selected.map(function (i) {
|
1769
|
+
return i.value;
|
1770
|
+
}));
|
1771
|
+
} else if (selected.length === 0) {
|
1772
|
+
_onChange8([]);
|
1773
|
+
onChangeHandler([]);
|
1774
|
+
}
|
1775
|
+
},
|
1776
|
+
options: options,
|
1777
|
+
selected: getDefaultValue(value, options),
|
1778
|
+
name: name,
|
1779
|
+
ref: ref,
|
1780
|
+
isInvalid: invalid,
|
1781
|
+
id: name + '-' + ID.uuid()
|
1782
|
+
}, inputProps));
|
1783
|
+
};
|
1784
|
+
if (value !== undefined) {
|
1785
|
+
controllerProps.defaultValue = value;
|
1786
|
+
}
|
1787
|
+
if ((item === null || item === void 0 ? void 0 : item.disabled) !== undefined) {
|
1788
|
+
var _item$disabled16;
|
1789
|
+
controllerProps.disabled = (_item$disabled16 = item === null || item === void 0 ? void 0 : item.disabled) !== null && _item$disabled16 !== void 0 ? _item$disabled16 : false;
|
1790
|
+
}
|
1791
|
+
if ((item === null || item === void 0 ? void 0 : item.required) !== undefined) {
|
1792
|
+
var _item$required24;
|
1793
|
+
controllerProps.required = (_item$required24 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required24 !== void 0 ? _item$required24 : false;
|
1794
|
+
}
|
1795
|
+
var labelLocation = 'ABOVE';
|
1796
|
+
if (item !== null && item !== void 0 && item.labelLocation) {
|
1797
|
+
labelLocation = item === null || item === void 0 ? void 0 : item.labelLocation;
|
1798
|
+
}
|
1799
|
+
var baseClasses = 'SortableItem rfb-item';
|
1800
|
+
if (item !== null && item !== void 0 && item.pageBreakBefore) {
|
1801
|
+
baseClasses += ' alwaysbreak';
|
1802
|
+
}
|
1803
|
+
if (!methods) {
|
1804
|
+
return /*#__PURE__*/React.createElement("div", {
|
1805
|
+
style: _objectSpread({}, style),
|
1806
|
+
className: baseClasses
|
1807
|
+
}, /*#__PURE__*/React.createElement(ComponentHeader, _extends({
|
1808
|
+
item: item
|
1809
|
+
}, props)), /*#__PURE__*/React.createElement(Form.Group, {
|
1810
|
+
className: "form-group mb-3"
|
1811
|
+
}, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Typeahead, _extends({
|
1812
|
+
labelKey: function labelKey(option) {
|
1813
|
+
return option.label;
|
1814
|
+
},
|
1815
|
+
options: options,
|
1816
|
+
selected: getDefaultValue(value, options),
|
1817
|
+
name: name,
|
1818
|
+
id: name + '-' + ID.uuid()
|
1819
|
+
}, inputProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
|
1820
|
+
item: item,
|
1821
|
+
className: item === null || item === void 0 ? void 0 : item.labelClassName,
|
1822
|
+
htmlFor: name
|
1823
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ComponentLabel, {
|
1824
|
+
item: item,
|
1825
|
+
className: item === null || item === void 0 ? void 0 : item.labelClassName,
|
1826
|
+
htmlFor: name
|
1827
|
+
}), /*#__PURE__*/React.createElement(Typeahead, _extends({
|
1828
|
+
labelKey: function labelKey(option) {
|
1829
|
+
return option.label;
|
1830
|
+
},
|
1831
|
+
options: options,
|
1832
|
+
selected: getDefaultValue(value, options),
|
1833
|
+
name: name,
|
1834
|
+
id: name + '-' + ID.uuid()
|
1835
|
+
}, inputProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
|
1836
|
+
muted: true
|
1837
|
+
}, item === null || item === void 0 ? void 0 : item.help) : null, /*#__PURE__*/React.createElement(ComponentErrorMessage, {
|
1838
|
+
name: name
|
1839
|
+
})));
|
1840
|
+
}
|
1841
|
+
if ((item === null || item === void 0 ? void 0 : item.print) === true) {
|
1842
|
+
return /*#__PURE__*/React.createElement("div", {
|
1843
|
+
style: _objectSpread({}, style),
|
1844
|
+
className: baseClasses
|
1845
|
+
}, /*#__PURE__*/React.createElement(Form.Group, {
|
1846
|
+
className: "form-group mb-3"
|
1847
|
+
}, /*#__PURE__*/React.createElement(ComponentLabel, {
|
1848
|
+
item: item,
|
1849
|
+
className: item === null || item === void 0 ? void 0 : item.labelClassName,
|
1850
|
+
htmlFor: name
|
1851
|
+
}), /*#__PURE__*/React.createElement("div", null, item === null || item === void 0 ? void 0 : item.options.filter(function (option) {
|
1852
|
+
return value === null || value === void 0 ? void 0 : value.includes(option.value);
|
1853
|
+
}).map(function (option) {
|
1854
|
+
return option.text;
|
1855
|
+
}).join(', '))));
|
1856
|
+
}
|
1857
|
+
return /*#__PURE__*/React.createElement("div", {
|
1858
|
+
style: _objectSpread({}, style),
|
1859
|
+
className: baseClasses
|
1860
|
+
}, /*#__PURE__*/React.createElement(ComponentHeader, _extends({
|
1861
|
+
item: item
|
1862
|
+
}, props)), /*#__PURE__*/React.createElement(Form.Group, {
|
1863
|
+
className: "form-group mb-3"
|
1864
|
+
}, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Controller, _extends({
|
1865
|
+
control: methods.control
|
1866
|
+
}, controllerProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
|
1867
|
+
item: item,
|
1868
|
+
className: item === null || item === void 0 ? void 0 : item.labelClassName,
|
1869
|
+
htmlFor: name
|
1870
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ComponentLabel, {
|
1871
|
+
item: item,
|
1872
|
+
className: item === null || item === void 0 ? void 0 : item.labelClassName,
|
1873
|
+
htmlFor: name
|
1874
|
+
}), /*#__PURE__*/React.createElement(Controller, _extends({
|
1875
|
+
control: methods.control
|
1876
|
+
}, controllerProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
|
1877
|
+
muted: true
|
1878
|
+
}, item === null || item === void 0 ? void 0 : item.help) : null, /*#__PURE__*/React.createElement(ComponentErrorMessage, {
|
1879
|
+
name: name
|
1880
|
+
})));
|
1881
|
+
};
|
1882
|
+
export var Checkboxes = /*#__PURE__*/function (_React$Component7) {
|
1831
1883
|
function Checkboxes(props) {
|
1832
|
-
var
|
1884
|
+
var _this3;
|
1833
1885
|
_classCallCheck(this, Checkboxes);
|
1834
|
-
|
1835
|
-
_defineProperty(
|
1836
|
-
var checkedValues =
|
1837
|
-
if (
|
1886
|
+
_this3 = _callSuper(this, Checkboxes, [props]);
|
1887
|
+
_defineProperty(_this3, "onCheckboxChange", function (checkboxValue, event) {
|
1888
|
+
var checkedValues = _this3.props.value;
|
1889
|
+
if (_this3.props.onChange) {
|
1838
1890
|
if (event.target.checked) {
|
1839
|
-
|
1891
|
+
_this3.props.onChange(checkedValues.concat(checkboxValue));
|
1840
1892
|
} else {
|
1841
|
-
|
1893
|
+
_this3.props.onChange(checkedValues.filter(function (v) {
|
1842
1894
|
return v !== checkboxValue;
|
1843
1895
|
}));
|
1844
1896
|
}
|
1845
1897
|
}
|
1846
1898
|
});
|
1847
|
-
|
1848
|
-
return
|
1899
|
+
_this3.options = {};
|
1900
|
+
return _this3;
|
1849
1901
|
}
|
1850
|
-
_inherits(Checkboxes, _React$
|
1902
|
+
_inherits(Checkboxes, _React$Component7);
|
1851
1903
|
return _createClass(Checkboxes, [{
|
1852
1904
|
key: "render",
|
1853
1905
|
value: function render() {
|
1854
|
-
var
|
1906
|
+
var _this4 = this;
|
1855
1907
|
var self = this;
|
1856
1908
|
var baseClasses = 'SortableItem rfb-item';
|
1857
1909
|
if (this.props.item.pageBreakBefore) {
|
@@ -1866,7 +1918,7 @@ export var Checkboxes = /*#__PURE__*/function (_React$Component8) {
|
|
1866
1918
|
}, /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
|
1867
1919
|
htmlFor: this.props.name
|
1868
1920
|
})), /*#__PURE__*/React.createElement("div", null, this.props.item.options.filter(function (option) {
|
1869
|
-
return
|
1921
|
+
return _this4.props.value.includes(option.value);
|
1870
1922
|
}).map(function (option) {
|
1871
1923
|
return option.text;
|
1872
1924
|
}).join(', '))));
|
@@ -1879,7 +1931,7 @@ export var Checkboxes = /*#__PURE__*/function (_React$Component8) {
|
|
1879
1931
|
}, /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
|
1880
1932
|
htmlFor: this.props.name
|
1881
1933
|
})), this.props.item.options.map(function (option) {
|
1882
|
-
var
|
1934
|
+
var _this4$props$checkbox;
|
1883
1935
|
var props = {};
|
1884
1936
|
props.name = "option_".concat(option.key);
|
1885
1937
|
props.value = option.value;
|
@@ -1890,7 +1942,7 @@ export var Checkboxes = /*#__PURE__*/function (_React$Component8) {
|
|
1890
1942
|
}
|
1891
1943
|
return /*#__PURE__*/React.createElement(ToggleButton, _extends({
|
1892
1944
|
type: "checkbox",
|
1893
|
-
variant: (
|
1945
|
+
variant: (_this4$props$checkbox = _this4.props.checkboxButtonClassName) !== null && _this4$props$checkbox !== void 0 ? _this4$props$checkbox : "outline-light",
|
1894
1946
|
className: "btn-survey-builder-checkbox",
|
1895
1947
|
key: "preview_".concat(option.key),
|
1896
1948
|
id: self.props.name + '-' + ID.uuid(),
|
@@ -1921,19 +1973,19 @@ export var Checkboxes = /*#__PURE__*/function (_React$Component8) {
|
|
1921
1973
|
}
|
1922
1974
|
}]);
|
1923
1975
|
}(React.Component);
|
1924
|
-
export var Checkbox = /*#__PURE__*/function (_React$
|
1976
|
+
export var Checkbox = /*#__PURE__*/function (_React$Component8) {
|
1925
1977
|
function Checkbox(props) {
|
1926
|
-
var
|
1978
|
+
var _this5;
|
1927
1979
|
_classCallCheck(this, Checkbox);
|
1928
|
-
|
1929
|
-
|
1930
|
-
return
|
1980
|
+
_this5 = _callSuper(this, Checkbox, [props]);
|
1981
|
+
_this5.inputField = /*#__PURE__*/React.createRef();
|
1982
|
+
return _this5;
|
1931
1983
|
}
|
1932
|
-
_inherits(Checkbox, _React$
|
1984
|
+
_inherits(Checkbox, _React$Component8);
|
1933
1985
|
return _createClass(Checkbox, [{
|
1934
1986
|
key: "render",
|
1935
1987
|
value: function render() {
|
1936
|
-
var
|
1988
|
+
var _this6 = this,
|
1937
1989
|
_this$props$checkboxB;
|
1938
1990
|
var baseClasses = 'SortableItem rfb-item';
|
1939
1991
|
if (this.props.item.pageBreakBefore) {
|
@@ -1943,8 +1995,8 @@ export var Checkbox = /*#__PURE__*/function (_React$Component9) {
|
|
1943
1995
|
// eslint-disable-next-line no-undef
|
1944
1996
|
props.name = this.props.name;
|
1945
1997
|
props.onChange = function (event) {
|
1946
|
-
if (
|
1947
|
-
|
1998
|
+
if (_this6.props.onChange) {
|
1999
|
+
_this6.props.onChange(event.target.checked);
|
1948
2000
|
}
|
1949
2001
|
};
|
1950
2002
|
//props.isInvalid = this.props.isInvalid;
|
@@ -2010,19 +2062,19 @@ export var Checkbox = /*#__PURE__*/function (_React$Component9) {
|
|
2010
2062
|
}
|
2011
2063
|
}]);
|
2012
2064
|
}(React.Component);
|
2013
|
-
export var RadioButtons = /*#__PURE__*/function (_React$
|
2065
|
+
export var RadioButtons = /*#__PURE__*/function (_React$Component9) {
|
2014
2066
|
function RadioButtons(props) {
|
2015
|
-
var
|
2067
|
+
var _this7;
|
2016
2068
|
_classCallCheck(this, RadioButtons);
|
2017
|
-
|
2018
|
-
|
2019
|
-
return
|
2069
|
+
_this7 = _callSuper(this, RadioButtons, [props]);
|
2070
|
+
_this7.options = {};
|
2071
|
+
return _this7;
|
2020
2072
|
}
|
2021
|
-
_inherits(RadioButtons, _React$
|
2073
|
+
_inherits(RadioButtons, _React$Component9);
|
2022
2074
|
return _createClass(RadioButtons, [{
|
2023
2075
|
key: "render",
|
2024
2076
|
value: function render() {
|
2025
|
-
var
|
2077
|
+
var _this8 = this;
|
2026
2078
|
var self = this;
|
2027
2079
|
var baseClasses = 'SortableItem rfb-item';
|
2028
2080
|
if (this.props.item.pageBreakBefore) {
|
@@ -2037,7 +2089,7 @@ export var RadioButtons = /*#__PURE__*/function (_React$Component10) {
|
|
2037
2089
|
}, /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
|
2038
2090
|
htmlFor: this.props.name
|
2039
2091
|
})), /*#__PURE__*/React.createElement("div", null, this.props.item.options.filter(function (option) {
|
2040
|
-
return
|
2092
|
+
return _this8.props.value === option.value;
|
2041
2093
|
}).map(function (option) {
|
2042
2094
|
return option.text;
|
2043
2095
|
}).join(', '))));
|
@@ -2097,12 +2149,12 @@ export var RadioButtons = /*#__PURE__*/function (_React$Component10) {
|
|
2097
2149
|
}
|
2098
2150
|
}]);
|
2099
2151
|
}(React.Component);
|
2100
|
-
export var Image = /*#__PURE__*/function (_React$
|
2152
|
+
export var Image = /*#__PURE__*/function (_React$Component10) {
|
2101
2153
|
function Image() {
|
2102
2154
|
_classCallCheck(this, Image);
|
2103
2155
|
return _callSuper(this, Image, arguments);
|
2104
2156
|
}
|
2105
|
-
_inherits(Image, _React$
|
2157
|
+
_inherits(Image, _React$Component10);
|
2106
2158
|
return _createClass(Image, [{
|
2107
2159
|
key: "render",
|
2108
2160
|
value: function render() {
|
@@ -2126,19 +2178,19 @@ export var Image = /*#__PURE__*/function (_React$Component11) {
|
|
2126
2178
|
}
|
2127
2179
|
}]);
|
2128
2180
|
}(React.Component);
|
2129
|
-
export var Rating = /*#__PURE__*/function (_React$
|
2181
|
+
export var Rating = /*#__PURE__*/function (_React$Component11) {
|
2130
2182
|
function Rating(props) {
|
2131
|
-
var
|
2183
|
+
var _this9;
|
2132
2184
|
_classCallCheck(this, Rating);
|
2133
|
-
|
2134
|
-
|
2135
|
-
return
|
2185
|
+
_this9 = _callSuper(this, Rating, [props]);
|
2186
|
+
_this9.inputField = /*#__PURE__*/React.createRef();
|
2187
|
+
return _this9;
|
2136
2188
|
}
|
2137
|
-
_inherits(Rating, _React$
|
2189
|
+
_inherits(Rating, _React$Component11);
|
2138
2190
|
return _createClass(Rating, [{
|
2139
2191
|
key: "render",
|
2140
2192
|
value: function render() {
|
2141
|
-
var
|
2193
|
+
var _this10 = this;
|
2142
2194
|
var props = {};
|
2143
2195
|
props.name = this.props.name;
|
2144
2196
|
props.ratingAmount = 5;
|
@@ -2147,9 +2199,9 @@ export var Rating = /*#__PURE__*/function (_React$Component12) {
|
|
2147
2199
|
if (this.props.item.disabled) {
|
2148
2200
|
props.disabled = true;
|
2149
2201
|
}
|
2150
|
-
props.onRatingClick = function (event,
|
2151
|
-
var rating =
|
2152
|
-
|
2202
|
+
props.onRatingClick = function (event, _ref20) {
|
2203
|
+
var rating = _ref20.rating;
|
2204
|
+
_this10.props.onChange(rating);
|
2153
2205
|
};
|
2154
2206
|
if (this.props.item.mutable) {
|
2155
2207
|
props.editing = true;
|
@@ -2184,12 +2236,12 @@ export var Rating = /*#__PURE__*/function (_React$Component12) {
|
|
2184
2236
|
}
|
2185
2237
|
}]);
|
2186
2238
|
}(React.Component);
|
2187
|
-
export var HyperLink = /*#__PURE__*/function (_React$
|
2239
|
+
export var HyperLink = /*#__PURE__*/function (_React$Component12) {
|
2188
2240
|
function HyperLink() {
|
2189
2241
|
_classCallCheck(this, HyperLink);
|
2190
2242
|
return _callSuper(this, HyperLink, arguments);
|
2191
2243
|
}
|
2192
|
-
_inherits(HyperLink, _React$
|
2244
|
+
_inherits(HyperLink, _React$Component12);
|
2193
2245
|
return _createClass(HyperLink, [{
|
2194
2246
|
key: "render",
|
2195
2247
|
value: function render() {
|
@@ -2212,12 +2264,12 @@ export var HyperLink = /*#__PURE__*/function (_React$Component13) {
|
|
2212
2264
|
}
|
2213
2265
|
}]);
|
2214
2266
|
}(React.Component);
|
2215
|
-
export var Download = /*#__PURE__*/function (_React$
|
2267
|
+
export var Download = /*#__PURE__*/function (_React$Component13) {
|
2216
2268
|
function Download() {
|
2217
2269
|
_classCallCheck(this, Download);
|
2218
2270
|
return _callSuper(this, Download, arguments);
|
2219
2271
|
}
|
2220
|
-
_inherits(Download, _React$
|
2272
|
+
_inherits(Download, _React$Component13);
|
2221
2273
|
return _createClass(Download, [{
|
2222
2274
|
key: "render",
|
2223
2275
|
value: function render() {
|
@@ -2236,41 +2288,41 @@ export var Download = /*#__PURE__*/function (_React$Component14) {
|
|
2236
2288
|
}
|
2237
2289
|
}]);
|
2238
2290
|
}(React.Component);
|
2239
|
-
export var Camera = /*#__PURE__*/function (_React$
|
2291
|
+
export var Camera = /*#__PURE__*/function (_React$Component14) {
|
2240
2292
|
function Camera(props) {
|
2241
|
-
var
|
2293
|
+
var _this11;
|
2242
2294
|
_classCallCheck(this, Camera);
|
2243
|
-
|
2244
|
-
_defineProperty(
|
2295
|
+
_this11 = _callSuper(this, Camera, [props]);
|
2296
|
+
_defineProperty(_this11, "handleChange", function (event) {
|
2245
2297
|
if (event.target.files && event.target.files.length > 0) {
|
2246
|
-
|
2298
|
+
_this11.setState({
|
2247
2299
|
img: event.target.files[0]
|
2248
2300
|
});
|
2249
|
-
if (
|
2250
|
-
|
2301
|
+
if (_this11.props.onChange) {
|
2302
|
+
_this11.props.onChange(event.target.files[0]);
|
2251
2303
|
}
|
2252
2304
|
}
|
2253
2305
|
});
|
2254
|
-
_defineProperty(
|
2255
|
-
|
2306
|
+
_defineProperty(_this11, "clearImage", function () {
|
2307
|
+
_this11.setState({
|
2256
2308
|
img: null
|
2257
2309
|
});
|
2258
|
-
if (
|
2259
|
-
|
2310
|
+
if (_this11.props.onChange) {
|
2311
|
+
_this11.props.onChange(null);
|
2260
2312
|
}
|
2261
2313
|
});
|
2262
|
-
|
2263
|
-
|
2314
|
+
_this11.inputField = /*#__PURE__*/React.createRef();
|
2315
|
+
_this11.state = {
|
2264
2316
|
img: props.value
|
2265
2317
|
};
|
2266
|
-
return
|
2318
|
+
return _this11;
|
2267
2319
|
}
|
2268
|
-
_inherits(Camera, _React$
|
2320
|
+
_inherits(Camera, _React$Component14);
|
2269
2321
|
return _createClass(Camera, [{
|
2270
2322
|
key: "getImageSizeProps",
|
2271
|
-
value: function getImageSizeProps(
|
2272
|
-
var width =
|
2273
|
-
height =
|
2323
|
+
value: function getImageSizeProps(_ref21) {
|
2324
|
+
var width = _ref21.width,
|
2325
|
+
height = _ref21.height;
|
2274
2326
|
var imgProps = {
|
2275
2327
|
width: '100%'
|
2276
2328
|
};
|
@@ -2363,37 +2415,37 @@ export var Camera = /*#__PURE__*/function (_React$Component15) {
|
|
2363
2415
|
}
|
2364
2416
|
}]);
|
2365
2417
|
}(React.Component);
|
2366
|
-
export var FileUpload = /*#__PURE__*/function (_React$
|
2418
|
+
export var FileUpload = /*#__PURE__*/function (_React$Component15) {
|
2367
2419
|
function FileUpload(props) {
|
2368
|
-
var
|
2420
|
+
var _this12;
|
2369
2421
|
_classCallCheck(this, FileUpload);
|
2370
|
-
|
2371
|
-
_defineProperty(
|
2422
|
+
_this12 = _callSuper(this, FileUpload, [props]);
|
2423
|
+
_defineProperty(_this12, "handleChange", function (event) {
|
2372
2424
|
if (event.target.files && event.target.files.length > 0) {
|
2373
|
-
|
2425
|
+
_this12.setState({
|
2374
2426
|
fileUpload: event.target.files[0]
|
2375
2427
|
});
|
2376
|
-
if (
|
2377
|
-
|
2428
|
+
if (_this12.props.onChange) {
|
2429
|
+
_this12.props.onChange(event.target.files[0]);
|
2378
2430
|
}
|
2379
2431
|
}
|
2380
2432
|
});
|
2381
|
-
_defineProperty(
|
2382
|
-
|
2433
|
+
_defineProperty(_this12, "clearFileUpload", function () {
|
2434
|
+
_this12.setState({
|
2383
2435
|
fileUpload: null
|
2384
2436
|
});
|
2385
|
-
if (
|
2386
|
-
|
2437
|
+
if (_this12.props.onChange) {
|
2438
|
+
_this12.props.onChange(null);
|
2387
2439
|
}
|
2388
2440
|
});
|
2389
|
-
_defineProperty(
|
2390
|
-
var
|
2441
|
+
_defineProperty(_this12, "saveFile", /*#__PURE__*/function () {
|
2442
|
+
var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
|
2391
2443
|
var sourceUrl, response, dispositionHeader, resBlob, blob, fileName, _fileName;
|
2392
2444
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
2393
2445
|
while (1) switch (_context2.prev = _context2.next) {
|
2394
2446
|
case 0:
|
2395
2447
|
e.preventDefault();
|
2396
|
-
sourceUrl =
|
2448
|
+
sourceUrl = _this12.props.value;
|
2397
2449
|
_context2.next = 4;
|
2398
2450
|
return fetch(sourceUrl, {
|
2399
2451
|
method: 'GET',
|
@@ -2412,7 +2464,7 @@ export var FileUpload = /*#__PURE__*/function (_React$Component16) {
|
|
2412
2464
|
resBlob = _context2.sent;
|
2413
2465
|
// eslint-disable-next-line no-undef
|
2414
2466
|
blob = new Blob([resBlob], {
|
2415
|
-
type:
|
2467
|
+
type: _this12.props.item.fileType || response.headers.get('Content-Type')
|
2416
2468
|
});
|
2417
2469
|
if (dispositionHeader && dispositionHeader.indexOf(';filename=') > -1) {
|
2418
2470
|
fileName = dispositionHeader.split(';filename=')[1];
|
@@ -2428,16 +2480,16 @@ export var FileUpload = /*#__PURE__*/function (_React$Component16) {
|
|
2428
2480
|
}, _callee2);
|
2429
2481
|
}));
|
2430
2482
|
return function (_x) {
|
2431
|
-
return
|
2483
|
+
return _ref22.apply(this, arguments);
|
2432
2484
|
};
|
2433
2485
|
}());
|
2434
|
-
|
2435
|
-
|
2486
|
+
_this12.inputField = /*#__PURE__*/React.createRef();
|
2487
|
+
_this12.state = {
|
2436
2488
|
fileUpload: props.value
|
2437
2489
|
};
|
2438
|
-
return
|
2490
|
+
return _this12;
|
2439
2491
|
}
|
2440
|
-
_inherits(FileUpload, _React$
|
2492
|
+
_inherits(FileUpload, _React$Component15);
|
2441
2493
|
return _createClass(FileUpload, [{
|
2442
2494
|
key: "render",
|
2443
2495
|
value: function render() {
|
@@ -2512,25 +2564,25 @@ export var FileUpload = /*#__PURE__*/function (_React$Component16) {
|
|
2512
2564
|
}
|
2513
2565
|
}]);
|
2514
2566
|
}(React.Component);
|
2515
|
-
export var Range = /*#__PURE__*/function (_React$
|
2567
|
+
export var Range = /*#__PURE__*/function (_React$Component16) {
|
2516
2568
|
function Range(props) {
|
2517
|
-
var
|
2569
|
+
var _this13;
|
2518
2570
|
_classCallCheck(this, Range);
|
2519
|
-
|
2520
|
-
|
2521
|
-
return
|
2571
|
+
_this13 = _callSuper(this, Range, [props]);
|
2572
|
+
_this13.inputField = /*#__PURE__*/React.createRef();
|
2573
|
+
return _this13;
|
2522
2574
|
}
|
2523
|
-
_inherits(Range, _React$
|
2575
|
+
_inherits(Range, _React$Component16);
|
2524
2576
|
return _createClass(Range, [{
|
2525
2577
|
key: "render",
|
2526
2578
|
value: function render() {
|
2527
|
-
var
|
2579
|
+
var _this14 = this;
|
2528
2580
|
var props = {};
|
2529
2581
|
var name = this.props.name;
|
2530
2582
|
props.name = this.props.name;
|
2531
2583
|
props.value = this.props.value;
|
2532
2584
|
props.onChange = function (event) {
|
2533
|
-
|
2585
|
+
_this14.props.onChange(event.target.value);
|
2534
2586
|
};
|
2535
2587
|
if (this.props.item.disabled) {
|
2536
2588
|
props.disabled = true;
|