react-survey-builder 1.0.6 → 1.0.8
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 +15 -15
- 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/lib/dynamic-option-list.js +52 -58
- package/lib/fieldset/FieldSet.js +7 -8
- package/lib/form.js +53 -51
- package/lib/index.js +6 -4
- package/lib/language-provider/IntlMessages.js +2 -2
- package/lib/language-provider/locales/en-us.json +9 -9
- package/lib/language-provider/locales/it-it.json +2 -2
- package/lib/language-provider/locales/vi-vn.json +1 -1
- package/lib/multi-column/MultiColumnRow.js +13 -14
- package/lib/multi-column/dustbin.js +2 -2
- package/lib/preview.js +9 -7
- package/lib/survey-elements/component-label.js +9 -5
- package/lib/survey-elements/custom-element.js +4 -5
- package/lib/survey-elements/date-picker.js +9 -15
- package/lib/survey-elements/header-bar.js +11 -8
- package/lib/survey-elements/index.js +231 -155
- package/lib/survey-elements-edit.js +134 -234
- package/lib/survey-validator.js +9 -9
- package/lib/toolbar-group-item.js +4 -2
- package/lib/toolbar.js +117 -82
- package/package.json +7 -3
- package/types/index.d.ts +23 -21
package/lib/survey-validator.js
CHANGED
@@ -14,6 +14,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _xss = _interopRequireDefault(require("xss"));
|
15
15
|
var _IntlMessages = _interopRequireDefault(require("./language-provider/IntlMessages"));
|
16
16
|
var _fa = require("react-icons/fa");
|
17
|
+
var _reactBootstrap = require("react-bootstrap");
|
17
18
|
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); }; }
|
18
19
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /**
|
19
20
|
* <SurveyValidator />
|
@@ -82,18 +83,17 @@ var SurveyValidator = exports["default"] = /*#__PURE__*/function (_React$Compone
|
|
82
83
|
}
|
83
84
|
});
|
84
85
|
});
|
85
|
-
return /*#__PURE__*/_react["default"].createElement("div", null, this.state.errors.length > 0 && /*#__PURE__*/_react["default"].createElement(
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
}, /*#__PURE__*/_react["default"].createElement(_fa.FaExclamationTriangle, {
|
86
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, this.state.errors.length > 0 && /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Alert, {
|
87
|
+
variant: "danger",
|
88
|
+
className: "validation-error d-flex-inline justify-content-between"
|
89
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_fa.FaExclamationTriangle, {
|
90
90
|
className: "float-start"
|
91
91
|
}), /*#__PURE__*/_react["default"].createElement("ul", {
|
92
92
|
className: "float-start"
|
93
|
-
}, errors)), /*#__PURE__*/_react["default"].createElement("div", {
|
94
|
-
|
95
|
-
|
96
|
-
className: "float-end
|
93
|
+
}, errors)), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Button, {
|
94
|
+
variant: "danger",
|
95
|
+
size: "sm",
|
96
|
+
className: "float-end",
|
97
97
|
onClick: this.dismissModal.bind(this)
|
98
98
|
}, /*#__PURE__*/_react["default"].createElement(_IntlMessages["default"], {
|
99
99
|
id: "dismiss"
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
exports["default"] = void 0;
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
11
|
+
var _reactBootstrap = require("react-bootstrap");
|
11
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
12
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
13
14
|
/**
|
@@ -28,8 +29,9 @@ function ToolbarGroupItem(props) {
|
|
28
29
|
var classShow = 'collapse' + (show ? ' show' : '');
|
29
30
|
return /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("div", {
|
30
31
|
className: "toolbar-group-item"
|
31
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
32
|
-
|
32
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Button, {
|
33
|
+
variant: "link",
|
34
|
+
className: "btn-block text-left",
|
33
35
|
type: "button",
|
34
36
|
onClick: onClick
|
35
37
|
}, name), /*#__PURE__*/_react["default"].createElement("div", {
|
package/lib/toolbar.js
CHANGED
@@ -20,6 +20,7 @@ var _UUID = _interopRequireDefault(require("./UUID"));
|
|
20
20
|
var _store = _interopRequireDefault(require("./stores/store"));
|
21
21
|
var _functions = require("./functions");
|
22
22
|
var _fa = require("react-icons/fa");
|
23
|
+
var _reactBootstrap = require("react-bootstrap");
|
23
24
|
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); }; }
|
24
25
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
25
26
|
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; }
|
@@ -28,7 +29,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
28
29
|
*/
|
29
30
|
// function isDefaultItem(item) {
|
30
31
|
// const keys = Object.keys(item);
|
31
|
-
// return keys.filter(x => x !== 'element' && x !== 'key' && x !== '
|
32
|
+
// return keys.filter(x => x !== 'element' && x !== 'key' && x !== 'groupName').length === 0;
|
32
33
|
// }
|
33
34
|
|
34
35
|
function buildItems(items, defaultItems) {
|
@@ -47,8 +48,8 @@ function buildItems(items, defaultItems) {
|
|
47
48
|
if (found) {
|
48
49
|
if (x.inherited !== false) {
|
49
50
|
found = _objectSpread(_objectSpread({}, found), x);
|
50
|
-
} else if (x.
|
51
|
-
found.
|
51
|
+
} else if (x.groupName) {
|
52
|
+
found.groupName = x.groupName;
|
52
53
|
}
|
53
54
|
}
|
54
55
|
return found || x;
|
@@ -56,16 +57,16 @@ function buildItems(items, defaultItems) {
|
|
56
57
|
}
|
57
58
|
function buildGroupItems(allItems) {
|
58
59
|
var items = allItems.filter(function (x) {
|
59
|
-
return !x.
|
60
|
+
return !x.groupName;
|
60
61
|
});
|
61
62
|
var gItems = allItems.filter(function (x) {
|
62
|
-
return !!x.
|
63
|
+
return !!x.groupName;
|
63
64
|
});
|
64
65
|
var grouped = (0, _functions.groupBy)(gItems, function (x) {
|
65
|
-
return x.
|
66
|
+
return x.groupName;
|
66
67
|
});
|
67
68
|
var groupKeys = gItems.map(function (x) {
|
68
|
-
return x.
|
69
|
+
return x.groupName;
|
69
70
|
}).filter(function (v, i, self) {
|
70
71
|
return self.indexOf(v) === i;
|
71
72
|
});
|
@@ -158,11 +159,13 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
158
159
|
label: intl.formatMessage({
|
159
160
|
id: 'place-holder-label'
|
160
161
|
}),
|
161
|
-
|
162
|
+
fieldName: 'dropdown_',
|
162
163
|
showCustomName: true,
|
163
164
|
showDescription: true,
|
164
165
|
showHelp: true,
|
165
|
-
options: []
|
166
|
+
options: [],
|
167
|
+
placeholder: 'Select One',
|
168
|
+
hideRequiredAlert: true
|
166
169
|
}, {
|
167
170
|
key: 'Tags',
|
168
171
|
canHaveAnswer: true,
|
@@ -173,11 +176,12 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
173
176
|
label: intl.formatMessage({
|
174
177
|
id: 'place-holder-label'
|
175
178
|
}),
|
176
|
-
|
179
|
+
fieldName: 'tags_',
|
177
180
|
showCustomName: true,
|
178
181
|
showDescription: true,
|
179
182
|
showHelp: true,
|
180
|
-
options: []
|
183
|
+
options: [],
|
184
|
+
hideRequiredAlert: true
|
181
185
|
}, {
|
182
186
|
key: 'Checkboxes',
|
183
187
|
canHaveAnswer: true,
|
@@ -188,11 +192,12 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
188
192
|
label: intl.formatMessage({
|
189
193
|
id: 'place-holder-label'
|
190
194
|
}),
|
191
|
-
|
195
|
+
fieldName: 'checkboxes_',
|
192
196
|
showCustomName: true,
|
193
197
|
showDescription: true,
|
194
198
|
showHelp: true,
|
195
|
-
options: []
|
199
|
+
options: [],
|
200
|
+
hideRequiredAlert: true
|
196
201
|
}, {
|
197
202
|
key: 'Checkbox',
|
198
203
|
canHaveAnswer: true,
|
@@ -203,11 +208,12 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
203
208
|
label: intl.formatMessage({
|
204
209
|
id: 'place-holder-label'
|
205
210
|
}),
|
206
|
-
|
211
|
+
fieldName: 'checkbox_',
|
207
212
|
showCustomName: true,
|
208
213
|
showDescription: true,
|
209
214
|
showHelp: true,
|
210
|
-
boxLabel: 'Agree To Rules & Regs'
|
215
|
+
boxLabel: 'Agree To Rules & Regs',
|
216
|
+
hideRequiredAlert: true
|
211
217
|
}, {
|
212
218
|
key: 'RadioButtons',
|
213
219
|
canHaveAnswer: true,
|
@@ -218,11 +224,12 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
218
224
|
label: intl.formatMessage({
|
219
225
|
id: 'place-holder-label'
|
220
226
|
}),
|
221
|
-
|
227
|
+
fieldName: 'radiobuttons_',
|
222
228
|
showCustomName: true,
|
223
229
|
showDescription: true,
|
224
230
|
showHelp: true,
|
225
|
-
options: []
|
231
|
+
options: [],
|
232
|
+
hideRequiredAlert: true
|
226
233
|
}, {
|
227
234
|
key: 'TextInput',
|
228
235
|
canHaveAnswer: true,
|
@@ -233,10 +240,14 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
233
240
|
id: 'place-holder-label'
|
234
241
|
}),
|
235
242
|
icon: _fa.FaFont,
|
236
|
-
|
243
|
+
fieldName: 'text_input_',
|
237
244
|
showCustomName: true,
|
238
245
|
showDescription: true,
|
239
|
-
showHelp: true
|
246
|
+
showHelp: true,
|
247
|
+
placeholder: intl.formatMessage({
|
248
|
+
id: 'place-holder-label'
|
249
|
+
}),
|
250
|
+
hideRequiredAlert: true
|
240
251
|
}, {
|
241
252
|
key: 'EmailInput',
|
242
253
|
canHaveAnswer: true,
|
@@ -247,11 +258,14 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
247
258
|
id: 'place-holder-email'
|
248
259
|
}),
|
249
260
|
icon: _fa.FaEnvelope,
|
250
|
-
|
261
|
+
fieldName: 'email_input_',
|
251
262
|
showCustomName: true,
|
252
263
|
showDescription: true,
|
253
264
|
showHelp: true,
|
254
|
-
placeholder:
|
265
|
+
placeholder: intl.formatMessage({
|
266
|
+
id: 'place-holder-email'
|
267
|
+
}),
|
268
|
+
hideRequiredAlert: true
|
255
269
|
}, {
|
256
270
|
key: 'NumberInput',
|
257
271
|
canHaveAnswer: true,
|
@@ -262,13 +276,14 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
262
276
|
id: 'place-holder-label'
|
263
277
|
}),
|
264
278
|
icon: _fa.FaPlus,
|
265
|
-
|
279
|
+
fieldName: 'number_input_',
|
266
280
|
showCustomName: true,
|
267
281
|
showDescription: true,
|
268
282
|
showHelp: true,
|
269
283
|
step: 1,
|
270
|
-
|
271
|
-
|
284
|
+
minValue: 0,
|
285
|
+
maxValue: 5,
|
286
|
+
hideRequiredAlert: true
|
272
287
|
}, {
|
273
288
|
key: 'PhoneNumber',
|
274
289
|
canHaveAnswer: true,
|
@@ -279,10 +294,11 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
279
294
|
id: 'place-holder-phone-number'
|
280
295
|
}),
|
281
296
|
icon: _fa.FaPhone,
|
282
|
-
|
297
|
+
fieldName: 'phone_input_',
|
283
298
|
showCustomName: true,
|
284
299
|
showDescription: true,
|
285
|
-
showHelp: true
|
300
|
+
showHelp: true,
|
301
|
+
hideRequiredAlert: true
|
286
302
|
}, {
|
287
303
|
key: 'TextArea',
|
288
304
|
canHaveAnswer: true,
|
@@ -293,10 +309,11 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
293
309
|
id: 'place-holder-label'
|
294
310
|
}),
|
295
311
|
icon: _fa.FaTextHeight,
|
296
|
-
|
312
|
+
fieldName: 'text_area_',
|
297
313
|
showCustomName: true,
|
298
314
|
showDescription: true,
|
299
|
-
showHelp: true
|
315
|
+
showHelp: true,
|
316
|
+
hideRequiredAlert: true
|
300
317
|
}, {
|
301
318
|
key: 'FieldSet',
|
302
319
|
canHaveAnswer: false,
|
@@ -307,7 +324,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
307
324
|
id: 'fieldset'
|
308
325
|
}),
|
309
326
|
icon: _fa.FaBars,
|
310
|
-
|
327
|
+
fieldName: 'fieldset-element'
|
311
328
|
}, {
|
312
329
|
key: 'TwoColumnRow',
|
313
330
|
canHaveAnswer: false,
|
@@ -316,7 +333,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
316
333
|
}),
|
317
334
|
label: '',
|
318
335
|
icon: _fa.FaColumns,
|
319
|
-
|
336
|
+
fieldName: 'two_col_row_'
|
320
337
|
}, {
|
321
338
|
key: 'ThreeColumnRow',
|
322
339
|
canHaveAnswer: false,
|
@@ -325,7 +342,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
325
342
|
}),
|
326
343
|
label: '',
|
327
344
|
icon: _fa.FaColumns,
|
328
|
-
|
345
|
+
fieldName: 'three_col_row_'
|
329
346
|
}, {
|
330
347
|
key: 'FourColumnRow',
|
331
348
|
element: 'MultiColumnRow',
|
@@ -335,9 +352,9 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
335
352
|
}),
|
336
353
|
label: '',
|
337
354
|
icon: _fa.FaColumns,
|
338
|
-
|
339
|
-
|
340
|
-
|
355
|
+
fieldName: 'four_col_row_',
|
356
|
+
colCount: 4,
|
357
|
+
className: 'col-md-3'
|
341
358
|
}, {
|
342
359
|
key: 'FiveColumnRow',
|
343
360
|
element: 'MultiColumnRow',
|
@@ -347,9 +364,9 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
347
364
|
}),
|
348
365
|
label: '',
|
349
366
|
icon: _fa.FaColumns,
|
350
|
-
|
351
|
-
|
352
|
-
|
367
|
+
fieldName: 'five_col_row_',
|
368
|
+
colCount: 5,
|
369
|
+
className: 'col'
|
353
370
|
}, {
|
354
371
|
key: 'SixColumnRow',
|
355
372
|
element: 'MultiColumnRow',
|
@@ -359,9 +376,9 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
359
376
|
}),
|
360
377
|
label: '',
|
361
378
|
icon: _fa.FaColumns,
|
362
|
-
|
363
|
-
|
364
|
-
|
379
|
+
fieldName: 'six_col_row_',
|
380
|
+
colCount: 6,
|
381
|
+
className: 'col-md-2'
|
365
382
|
}, {
|
366
383
|
key: 'Image',
|
367
384
|
name: intl.formatMessage({
|
@@ -369,7 +386,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
369
386
|
}),
|
370
387
|
label: '',
|
371
388
|
icon: _fa.FaRegImage,
|
372
|
-
|
389
|
+
fieldName: 'image_',
|
373
390
|
src: ''
|
374
391
|
}, {
|
375
392
|
key: 'Rating',
|
@@ -381,7 +398,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
381
398
|
id: 'place-holder-label'
|
382
399
|
}),
|
383
400
|
icon: _fa.FaStar,
|
384
|
-
|
401
|
+
fieldName: 'rating_',
|
385
402
|
showCustomName: true,
|
386
403
|
showDescription: true,
|
387
404
|
showHelp: true
|
@@ -401,10 +418,11 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
401
418
|
label: intl.formatMessage({
|
402
419
|
id: 'place-holder-label'
|
403
420
|
}),
|
404
|
-
|
421
|
+
fieldName: 'date_picker_',
|
405
422
|
showCustomName: true,
|
406
423
|
showDescription: true,
|
407
|
-
showHelp: true
|
424
|
+
showHelp: true,
|
425
|
+
hideRequiredAlert: true
|
408
426
|
}, {
|
409
427
|
key: 'Signature',
|
410
428
|
canReadOnly: true,
|
@@ -415,7 +433,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
415
433
|
label: intl.formatMessage({
|
416
434
|
id: 'signature'
|
417
435
|
}),
|
418
|
-
|
436
|
+
fieldName: 'signature_'
|
419
437
|
}, {
|
420
438
|
key: 'HyperLink',
|
421
439
|
name: intl.formatMessage({
|
@@ -437,8 +455,8 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
437
455
|
content: intl.formatMessage({
|
438
456
|
id: 'place-holder-file-name'
|
439
457
|
}),
|
440
|
-
|
441
|
-
|
458
|
+
fieldName: 'download_',
|
459
|
+
filePath: '',
|
442
460
|
_href: ''
|
443
461
|
}, {
|
444
462
|
key: 'Range',
|
@@ -449,20 +467,21 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
449
467
|
label: intl.formatMessage({
|
450
468
|
id: 'place-holder-label'
|
451
469
|
}),
|
452
|
-
|
470
|
+
fieldName: 'range_',
|
453
471
|
step: 1,
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
472
|
+
defaultValue: 3,
|
473
|
+
minValue: 1,
|
474
|
+
maxValue: 5,
|
475
|
+
minLabel: intl.formatMessage({
|
458
476
|
id: 'easy'
|
459
477
|
}),
|
460
|
-
|
478
|
+
maxLabel: intl.formatMessage({
|
461
479
|
id: 'difficult'
|
462
480
|
}),
|
463
481
|
showCustomName: true,
|
464
482
|
showDescription: true,
|
465
|
-
showHelp: true
|
483
|
+
showHelp: true,
|
484
|
+
hideRequiredAlert: true
|
466
485
|
}, {
|
467
486
|
key: 'Camera',
|
468
487
|
name: intl.formatMessage({
|
@@ -472,7 +491,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
472
491
|
label: intl.formatMessage({
|
473
492
|
id: 'place-holder-label'
|
474
493
|
}),
|
475
|
-
|
494
|
+
fieldName: 'camera_'
|
476
495
|
}, {
|
477
496
|
key: 'FileUpload',
|
478
497
|
name: intl.formatMessage({
|
@@ -482,7 +501,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
482
501
|
label: intl.formatMessage({
|
483
502
|
id: 'place-holder-label'
|
484
503
|
}),
|
485
|
-
|
504
|
+
fieldName: 'file_upload_'
|
486
505
|
}];
|
487
506
|
}
|
488
507
|
}, {
|
@@ -492,7 +511,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
492
511
|
var customOptions = _objectSpread(_objectSpread({}, item), elementOptions);
|
493
512
|
customOptions.custom = true;
|
494
513
|
customOptions.component = item.component || null;
|
495
|
-
customOptions.
|
514
|
+
customOptions.customOptions = item.customOptions || [];
|
496
515
|
return customOptions;
|
497
516
|
}
|
498
517
|
return elementOptions;
|
@@ -506,19 +525,21 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
506
525
|
id: _UUID["default"].uuid(),
|
507
526
|
element: element,
|
508
527
|
text: item.name,
|
509
|
-
|
528
|
+
groupName: item.groupName,
|
510
529
|
"static": item["static"],
|
511
530
|
required: false,
|
512
|
-
showDescription: item.showDescription
|
531
|
+
showDescription: item.showDescription,
|
532
|
+
hideRequiredAlert: item.hideRequiredAlert
|
513
533
|
});
|
514
534
|
if (this.props.showDescription === true && !item["static"]) {
|
515
535
|
elementOptions.showDescription = true;
|
516
536
|
}
|
517
537
|
|
518
538
|
// add placeholder to form input
|
519
|
-
if (['NumberInput', 'EmailInput', 'TextInput', 'PhoneNumber', 'TextArea', 'DatePicker'].indexOf(element) !== -1) {
|
539
|
+
if (['NumberInput', 'EmailInput', 'TextInput', 'PhoneNumber', 'TextArea', 'DatePicker', 'Dropdown'].indexOf(element) !== -1) {
|
520
540
|
elementOptions.showPlaceholder = true;
|
521
541
|
}
|
542
|
+
elementOptions.placeholder = item.placeholder;
|
522
543
|
if (item.type === 'custom') {
|
523
544
|
elementOptions.key = item.key;
|
524
545
|
elementOptions.custom = true;
|
@@ -526,16 +547,17 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
526
547
|
elementOptions.bare = item.bare;
|
527
548
|
elementOptions.props = item.props;
|
528
549
|
elementOptions.component = item.component || null;
|
529
|
-
elementOptions.
|
550
|
+
elementOptions.customOptions = item.customOptions || [];
|
530
551
|
}
|
531
552
|
if (item["static"]) {
|
532
553
|
elementOptions.bold = false;
|
533
554
|
elementOptions.italic = false;
|
534
555
|
}
|
535
556
|
elementOptions.showCustomName = item.showCustomName;
|
536
|
-
elementOptions.
|
557
|
+
elementOptions.customName = item.customName;
|
537
558
|
elementOptions.showHelp = item.showHelp;
|
538
559
|
elementOptions.help = item.help;
|
560
|
+
elementOptions.hideRequiredAlert = item.hideRequiredAlert;
|
539
561
|
if (item.canHaveAnswer) {
|
540
562
|
elementOptions.canHaveAnswer = item.canHaveAnswer;
|
541
563
|
}
|
@@ -563,8 +585,8 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
563
585
|
elementOptions.canHaveOptionCorrect = item.canHaveOptionCorrect !== false;
|
564
586
|
elementOptions.canHaveOptionValue = item.canHaveOptionValue !== false;
|
565
587
|
elementOptions.canPopulateFromApi = item.canPopulateFromApi !== false;
|
566
|
-
if (item.
|
567
|
-
elementOptions.
|
588
|
+
if (item.className) {
|
589
|
+
elementOptions.className = item.className;
|
568
590
|
}
|
569
591
|
if (element === 'Image') {
|
570
592
|
elementOptions.src = item.src;
|
@@ -578,32 +600,35 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
578
600
|
}
|
579
601
|
if (element === 'Download') {
|
580
602
|
elementOptions._href = item._href;
|
581
|
-
elementOptions.
|
603
|
+
elementOptions.filePath = item.filePath;
|
582
604
|
}
|
583
605
|
if (element === 'NumberInput') {
|
584
606
|
elementOptions.step = item.step;
|
585
|
-
elementOptions.
|
586
|
-
elementOptions.
|
607
|
+
elementOptions.minValue = item.minValue;
|
608
|
+
elementOptions.maxValue = item.maxValue;
|
587
609
|
}
|
588
610
|
if (element === 'Range') {
|
589
611
|
elementOptions.step = item.step;
|
590
|
-
elementOptions.
|
591
|
-
elementOptions.
|
592
|
-
elementOptions.
|
593
|
-
elementOptions.
|
594
|
-
elementOptions.
|
612
|
+
elementOptions.defaultValue = item.defaultValue;
|
613
|
+
elementOptions.minValue = item.minValue;
|
614
|
+
elementOptions.maxValue = item.maxValue;
|
615
|
+
elementOptions.minLabel = item.minLabel;
|
616
|
+
elementOptions.maxLabel = item.maxLabel;
|
595
617
|
}
|
596
618
|
if (element === 'MultiColumnRow') {
|
597
|
-
elementOptions.
|
619
|
+
elementOptions.colCount = item.colCount;
|
598
620
|
}
|
599
621
|
if (item.defaultValue) {
|
600
622
|
elementOptions.defaultValue = item.defaultValue;
|
601
623
|
}
|
602
|
-
if (item.
|
603
|
-
elementOptions.
|
624
|
+
if (item.fieldName) {
|
625
|
+
elementOptions.fieldName = item.fieldName + _UUID["default"].uuid();
|
626
|
+
}
|
627
|
+
if (item.customName) {
|
628
|
+
elementOptions.fieldName = item.customName;
|
604
629
|
}
|
605
630
|
if (item.label) {
|
606
|
-
elementOptions.label = item.label;
|
631
|
+
elementOptions.label = item.label.trim();
|
607
632
|
}
|
608
633
|
if (item.options) {
|
609
634
|
if (item.options.length > 0) {
|
@@ -632,8 +657,9 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
632
657
|
items = _buildGroupItems.items,
|
633
658
|
grouped = _buildGroupItems.grouped,
|
634
659
|
groupKeys = _buildGroupItems.groupKeys;
|
635
|
-
return /*#__PURE__*/_react["default"].createElement(
|
636
|
-
|
660
|
+
return /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Col, {
|
661
|
+
md: 3,
|
662
|
+
className: "react-survey-builder-toolbar"
|
637
663
|
}, /*#__PURE__*/_react["default"].createElement("h4", null, this.props.intl.formatMessage({
|
638
664
|
id: 'toolbox'
|
639
665
|
})), /*#__PURE__*/_react["default"].createElement("ul", null, items.map(this.renderItem), groupKeys.map(function (k) {
|
@@ -696,10 +722,19 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
696
722
|
id: 'place-holder-option-1'
|
697
723
|
}),
|
698
724
|
key: "checkboxes_option_".concat(_UUID["default"].uuid())
|
699
|
-
}
|
700
|
-
|
701
|
-
|
702
|
-
|
725
|
+
}, {
|
726
|
+
value: 'place_holder_option_2',
|
727
|
+
text: intl.formatMessage({
|
728
|
+
id: 'place-holder-option-2'
|
729
|
+
}),
|
730
|
+
key: "checkboxes_option_".concat(_UUID["default"].uuid())
|
731
|
+
}, {
|
732
|
+
value: 'place_holder_option_3',
|
733
|
+
text: intl.formatMessage({
|
734
|
+
id: 'place-holder-option-3'
|
735
|
+
}),
|
736
|
+
key: "checkboxes_option_".concat(_UUID["default"].uuid())
|
737
|
+
}];
|
703
738
|
case 'RadioButtons':
|
704
739
|
return [{
|
705
740
|
value: 'place_holder_option_1',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-survey-builder",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.8",
|
4
4
|
"description": "A complete survey builder for react.",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"types": "types/index.d.ts",
|
@@ -28,7 +28,6 @@
|
|
28
28
|
},
|
29
29
|
"author": "Garrett Lang",
|
30
30
|
"dependencies": {
|
31
|
-
"@fortawesome/react-fontawesome": "^0.2.0",
|
32
31
|
"beedle": "^0.8.1",
|
33
32
|
"classnames": "^2.2.6",
|
34
33
|
"date-fns": "^2.16.1",
|
@@ -47,6 +46,7 @@
|
|
47
46
|
"react-dnd-html5-backend": "^11.1.3",
|
48
47
|
"react-draft-wysiwyg": "^1.15.0",
|
49
48
|
"react-icons": "^5.0.1",
|
49
|
+
"react-imask": "^7.0.1",
|
50
50
|
"react-intl": "^5.24.3",
|
51
51
|
"react-select": "^5.8.0",
|
52
52
|
"react-signature-canvas": "^1.0.3",
|
@@ -55,7 +55,10 @@
|
|
55
55
|
},
|
56
56
|
"peerDependencies": {
|
57
57
|
"react": ">=18.2.0",
|
58
|
-
"react-
|
58
|
+
"react-bootstrap": ">=2.9.2",
|
59
|
+
"react-dom": ">=18.2.0",
|
60
|
+
"react-icons": ">=5.0.1",
|
61
|
+
"react-imask": ">=7.0.1"
|
59
62
|
},
|
60
63
|
"devDependencies": {
|
61
64
|
"@babel/cli": "^7.12.10",
|
@@ -82,6 +85,7 @@
|
|
82
85
|
"express": "^4.17.1",
|
83
86
|
"multer": "^1.4.2",
|
84
87
|
"react": "^18.2.0",
|
88
|
+
"react-bootstrap": "^2.9.2",
|
85
89
|
"react-dom": "^18.2.0",
|
86
90
|
"rimraf": "^3.0.2",
|
87
91
|
"sass": "^1.69.7",
|