react-survey-builder 1.0.9 → 1.0.11
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
package/lib/toolbar.js
CHANGED
@@ -20,7 +20,6 @@ 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");
|
24
23
|
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); }; }
|
25
24
|
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; } }
|
26
25
|
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; }
|
@@ -182,7 +181,9 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
182
181
|
showDescription: true,
|
183
182
|
showHelp: true,
|
184
183
|
options: [],
|
185
|
-
|
184
|
+
placeholder: 'Select...',
|
185
|
+
hideRequiredAlert: true,
|
186
|
+
showLabelLocationPicker: true
|
186
187
|
}, {
|
187
188
|
key: 'Checkboxes',
|
188
189
|
canHaveAnswer: true,
|
@@ -270,35 +271,38 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
270
271
|
hideRequiredAlert: true,
|
271
272
|
showLabelLocationPicker: true
|
272
273
|
}, {
|
273
|
-
key: '
|
274
|
+
key: 'PhoneNumber',
|
274
275
|
canHaveAnswer: true,
|
275
276
|
name: intl.formatMessage({
|
276
|
-
id: '
|
277
|
+
id: 'phone-input'
|
277
278
|
}),
|
278
279
|
label: intl.formatMessage({
|
279
|
-
id: 'place-holder-
|
280
|
+
id: 'place-holder-phone-number'
|
280
281
|
}),
|
281
|
-
icon: _fa.
|
282
|
-
fieldName: '
|
282
|
+
icon: _fa.FaPhone,
|
283
|
+
fieldName: 'phone_input_',
|
283
284
|
showCustomName: true,
|
284
285
|
showDescription: true,
|
285
286
|
showHelp: true,
|
286
|
-
step: 1,
|
287
|
-
minValue: 0,
|
288
|
-
maxValue: 5,
|
289
287
|
hideRequiredAlert: true,
|
290
288
|
showLabelLocationPicker: true
|
291
289
|
}, {
|
292
|
-
key: '
|
293
|
-
|
290
|
+
key: 'DatePicker',
|
291
|
+
canDefaultToday: true,
|
292
|
+
canReadOnly: true,
|
293
|
+
dateFormat: 'MM/DD/YYYY',
|
294
|
+
timeFormat: 'hh:mm aa',
|
295
|
+
showTimeSelect: false,
|
296
|
+
showTimeSelectOnly: false,
|
297
|
+
showTimeInput: false,
|
294
298
|
name: intl.formatMessage({
|
295
|
-
id: '
|
299
|
+
id: 'date'
|
296
300
|
}),
|
301
|
+
icon: _fa.FaRegCalendarAlt,
|
297
302
|
label: intl.formatMessage({
|
298
|
-
id: 'place-holder-
|
303
|
+
id: 'place-holder-label'
|
299
304
|
}),
|
300
|
-
|
301
|
-
fieldName: 'phone_input_',
|
305
|
+
fieldName: 'date_picker_',
|
302
306
|
showCustomName: true,
|
303
307
|
showDescription: true,
|
304
308
|
showHelp: true,
|
@@ -321,79 +325,24 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
321
325
|
hideRequiredAlert: true,
|
322
326
|
showLabelLocationPicker: true
|
323
327
|
}, {
|
324
|
-
key: '
|
325
|
-
canHaveAnswer:
|
328
|
+
key: 'NumberInput',
|
329
|
+
canHaveAnswer: true,
|
326
330
|
name: intl.formatMessage({
|
327
|
-
id: '
|
331
|
+
id: 'number-input'
|
328
332
|
}),
|
329
333
|
label: intl.formatMessage({
|
330
|
-
id: '
|
331
|
-
}),
|
332
|
-
icon: _fa.FaBars,
|
333
|
-
fieldName: 'fieldset-element'
|
334
|
-
}, {
|
335
|
-
key: 'TwoColumnRow',
|
336
|
-
canHaveAnswer: false,
|
337
|
-
name: intl.formatMessage({
|
338
|
-
id: 'two-columns-row'
|
339
|
-
}),
|
340
|
-
label: '',
|
341
|
-
icon: _fa.FaColumns,
|
342
|
-
fieldName: 'two_col_row_'
|
343
|
-
}, {
|
344
|
-
key: 'ThreeColumnRow',
|
345
|
-
canHaveAnswer: false,
|
346
|
-
name: intl.formatMessage({
|
347
|
-
id: 'three-columns-row'
|
348
|
-
}),
|
349
|
-
label: '',
|
350
|
-
icon: _fa.FaColumns,
|
351
|
-
fieldName: 'three_col_row_'
|
352
|
-
}, {
|
353
|
-
key: 'FourColumnRow',
|
354
|
-
element: 'MultiColumnRow',
|
355
|
-
canHaveAnswer: false,
|
356
|
-
name: intl.formatMessage({
|
357
|
-
id: 'four-columns-row'
|
358
|
-
}),
|
359
|
-
label: '',
|
360
|
-
icon: _fa.FaColumns,
|
361
|
-
fieldName: 'four_col_row_',
|
362
|
-
colCount: 4,
|
363
|
-
className: 'col-md-3'
|
364
|
-
}, {
|
365
|
-
key: 'FiveColumnRow',
|
366
|
-
element: 'MultiColumnRow',
|
367
|
-
canHaveAnswer: false,
|
368
|
-
name: intl.formatMessage({
|
369
|
-
id: 'five-columns-row'
|
370
|
-
}),
|
371
|
-
label: '',
|
372
|
-
icon: _fa.FaColumns,
|
373
|
-
fieldName: 'five_col_row_',
|
374
|
-
colCount: 5,
|
375
|
-
className: 'col'
|
376
|
-
}, {
|
377
|
-
key: 'SixColumnRow',
|
378
|
-
element: 'MultiColumnRow',
|
379
|
-
canHaveAnswer: false,
|
380
|
-
name: intl.formatMessage({
|
381
|
-
id: 'six-columns-row'
|
382
|
-
}),
|
383
|
-
label: '',
|
384
|
-
icon: _fa.FaColumns,
|
385
|
-
fieldName: 'six_col_row_',
|
386
|
-
colCount: 6,
|
387
|
-
className: 'col-md-2'
|
388
|
-
}, {
|
389
|
-
key: 'Image',
|
390
|
-
name: intl.formatMessage({
|
391
|
-
id: 'image'
|
334
|
+
id: 'place-holder-label'
|
392
335
|
}),
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
336
|
+
icon: _fa.FaPlus,
|
337
|
+
fieldName: 'number_input_',
|
338
|
+
showCustomName: true,
|
339
|
+
showDescription: true,
|
340
|
+
showHelp: true,
|
341
|
+
step: 1,
|
342
|
+
minValue: 0,
|
343
|
+
maxValue: 5,
|
344
|
+
hideRequiredAlert: true,
|
345
|
+
showLabelLocationPicker: true
|
397
346
|
}, {
|
398
347
|
key: 'Rating',
|
399
348
|
canHaveAnswer: true,
|
@@ -409,22 +358,25 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
409
358
|
showDescription: true,
|
410
359
|
showHelp: true
|
411
360
|
}, {
|
412
|
-
key: '
|
413
|
-
canDefaultToday: true,
|
414
|
-
canReadOnly: true,
|
415
|
-
dateFormat: 'MM/dd/yyyy',
|
416
|
-
timeFormat: 'hh:mm aa',
|
417
|
-
showTimeSelect: false,
|
418
|
-
showTimeSelectOnly: false,
|
419
|
-
showTimeInput: false,
|
361
|
+
key: 'Range',
|
420
362
|
name: intl.formatMessage({
|
421
|
-
id: '
|
363
|
+
id: 'range'
|
422
364
|
}),
|
423
|
-
icon: _fa.
|
365
|
+
icon: _fa.FaSlidersH,
|
424
366
|
label: intl.formatMessage({
|
425
367
|
id: 'place-holder-label'
|
426
368
|
}),
|
427
|
-
fieldName: '
|
369
|
+
fieldName: 'range_',
|
370
|
+
step: 1,
|
371
|
+
defaultValue: 3,
|
372
|
+
minValue: 1,
|
373
|
+
maxValue: 5,
|
374
|
+
minLabel: intl.formatMessage({
|
375
|
+
id: 'easy'
|
376
|
+
}),
|
377
|
+
maxLabel: intl.formatMessage({
|
378
|
+
id: 'difficult'
|
379
|
+
}),
|
428
380
|
showCustomName: true,
|
429
381
|
showDescription: true,
|
430
382
|
showHelp: true,
|
@@ -439,7 +391,51 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
439
391
|
label: intl.formatMessage({
|
440
392
|
id: 'signature'
|
441
393
|
}),
|
442
|
-
fieldName: 'signature_'
|
394
|
+
fieldName: 'signature_',
|
395
|
+
showCustomName: true,
|
396
|
+
showDescription: true,
|
397
|
+
showHelp: true,
|
398
|
+
hideRequiredAlert: true
|
399
|
+
}, {
|
400
|
+
key: 'Camera',
|
401
|
+
name: intl.formatMessage({
|
402
|
+
id: 'camera'
|
403
|
+
}),
|
404
|
+
icon: _fa.FaCamera,
|
405
|
+
label: intl.formatMessage({
|
406
|
+
id: 'place-holder-label'
|
407
|
+
}),
|
408
|
+
fieldName: 'camera_'
|
409
|
+
}, {
|
410
|
+
key: 'FileUpload',
|
411
|
+
name: intl.formatMessage({
|
412
|
+
id: 'file-upload'
|
413
|
+
}),
|
414
|
+
icon: _fa.FaFile,
|
415
|
+
label: intl.formatMessage({
|
416
|
+
id: 'place-holder-label'
|
417
|
+
}),
|
418
|
+
fieldName: 'file_upload_'
|
419
|
+
}, {
|
420
|
+
key: 'FieldSet',
|
421
|
+
canHaveAnswer: false,
|
422
|
+
name: intl.formatMessage({
|
423
|
+
id: 'fieldset'
|
424
|
+
}),
|
425
|
+
label: intl.formatMessage({
|
426
|
+
id: 'fieldset'
|
427
|
+
}),
|
428
|
+
icon: _fa.FaBars,
|
429
|
+
fieldName: 'fieldset-element'
|
430
|
+
}, {
|
431
|
+
key: 'Image',
|
432
|
+
name: intl.formatMessage({
|
433
|
+
id: 'image'
|
434
|
+
}),
|
435
|
+
label: '',
|
436
|
+
icon: _fa.FaRegImage,
|
437
|
+
fieldName: 'image_',
|
438
|
+
src: ''
|
443
439
|
}, {
|
444
440
|
key: 'HyperLink',
|
445
441
|
name: intl.formatMessage({
|
@@ -465,49 +461,59 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
465
461
|
filePath: '',
|
466
462
|
_href: ''
|
467
463
|
}, {
|
468
|
-
key: '
|
464
|
+
key: 'TwoColumnRow',
|
465
|
+
canHaveAnswer: false,
|
469
466
|
name: intl.formatMessage({
|
470
|
-
id: '
|
471
|
-
}),
|
472
|
-
icon: _fa.FaSlidersH,
|
473
|
-
label: intl.formatMessage({
|
474
|
-
id: 'place-holder-label'
|
475
|
-
}),
|
476
|
-
fieldName: 'range_',
|
477
|
-
step: 1,
|
478
|
-
defaultValue: 3,
|
479
|
-
minValue: 1,
|
480
|
-
maxValue: 5,
|
481
|
-
minLabel: intl.formatMessage({
|
482
|
-
id: 'easy'
|
483
|
-
}),
|
484
|
-
maxLabel: intl.formatMessage({
|
485
|
-
id: 'difficult'
|
467
|
+
id: 'two-columns-row'
|
486
468
|
}),
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
hideRequiredAlert: true
|
469
|
+
label: '',
|
470
|
+
icon: _fa.FaColumns,
|
471
|
+
fieldName: 'two_col_row_'
|
491
472
|
}, {
|
492
|
-
key: '
|
473
|
+
key: 'ThreeColumnRow',
|
474
|
+
canHaveAnswer: false,
|
493
475
|
name: intl.formatMessage({
|
494
|
-
id: '
|
476
|
+
id: 'three-columns-row'
|
495
477
|
}),
|
496
|
-
|
497
|
-
|
498
|
-
|
478
|
+
label: '',
|
479
|
+
icon: _fa.FaColumns,
|
480
|
+
fieldName: 'three_col_row_'
|
481
|
+
}, {
|
482
|
+
key: 'FourColumnRow',
|
483
|
+
element: 'MultiColumnRow',
|
484
|
+
canHaveAnswer: false,
|
485
|
+
name: intl.formatMessage({
|
486
|
+
id: 'four-columns-row'
|
499
487
|
}),
|
500
|
-
|
488
|
+
label: '',
|
489
|
+
icon: _fa.FaColumns,
|
490
|
+
fieldName: 'four_col_row_',
|
491
|
+
colCount: 4,
|
492
|
+
className: 'col-md-3'
|
501
493
|
}, {
|
502
|
-
key: '
|
494
|
+
key: 'FiveColumnRow',
|
495
|
+
element: 'MultiColumnRow',
|
496
|
+
canHaveAnswer: false,
|
503
497
|
name: intl.formatMessage({
|
504
|
-
id: '
|
498
|
+
id: 'five-columns-row'
|
505
499
|
}),
|
506
|
-
|
507
|
-
|
508
|
-
|
500
|
+
label: '',
|
501
|
+
icon: _fa.FaColumns,
|
502
|
+
fieldName: 'five_col_row_',
|
503
|
+
colCount: 5,
|
504
|
+
className: 'col'
|
505
|
+
}, {
|
506
|
+
key: 'SixColumnRow',
|
507
|
+
element: 'MultiColumnRow',
|
508
|
+
canHaveAnswer: false,
|
509
|
+
name: intl.formatMessage({
|
510
|
+
id: 'six-columns-row'
|
509
511
|
}),
|
510
|
-
|
512
|
+
label: '',
|
513
|
+
icon: _fa.FaColumns,
|
514
|
+
fieldName: 'six_col_row_',
|
515
|
+
colCount: 6,
|
516
|
+
className: 'col-md-2'
|
511
517
|
}];
|
512
518
|
}
|
513
519
|
}, {
|
@@ -542,7 +548,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
542
548
|
}
|
543
549
|
|
544
550
|
// add placeholder to form input
|
545
|
-
if (['NumberInput', 'EmailInput', 'TextInput', 'PhoneNumber', 'TextArea', 'DatePicker', 'Dropdown'].indexOf(element) !== -1) {
|
551
|
+
if (['NumberInput', 'EmailInput', 'TextInput', 'PhoneNumber', 'TextArea', 'DatePicker', 'Dropdown', 'Tags'].indexOf(element) !== -1) {
|
546
552
|
elementOptions.showPlaceholder = true;
|
547
553
|
}
|
548
554
|
elementOptions.placeholder = item.placeholder;
|
@@ -665,8 +671,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
665
671
|
items = _buildGroupItems.items,
|
666
672
|
grouped = _buildGroupItems.grouped,
|
667
673
|
groupKeys = _buildGroupItems.groupKeys;
|
668
|
-
return /*#__PURE__*/_react["default"].createElement(
|
669
|
-
md: 3,
|
674
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
670
675
|
className: "react-survey-builder-toolbar"
|
671
676
|
}, /*#__PURE__*/_react["default"].createElement("h4", null, this.props.intl.formatMessage({
|
672
677
|
id: 'toolbox'
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-survey-builder",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.11",
|
4
4
|
"description": "A complete survey builder for react.",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"types": "types/index.d.ts",
|
@@ -28,8 +28,10 @@
|
|
28
28
|
},
|
29
29
|
"author": "Garrett Lang",
|
30
30
|
"dependencies": {
|
31
|
+
"@hookform/error-message": ">=2.0.1",
|
31
32
|
"beedle": "^0.8.1",
|
32
33
|
"classnames": "^2.2.6",
|
34
|
+
"create-react-class": "^15.7.0",
|
33
35
|
"date-fns": "^2.16.1",
|
34
36
|
"draft-js": "^0.11.7",
|
35
37
|
"draftjs-to-html": "^0.9.1",
|
@@ -39,14 +41,18 @@
|
|
39
41
|
"immutability-helper": "^3.1.1",
|
40
42
|
"isomorphic-fetch": "^3.0.0",
|
41
43
|
"lodash": "^4.17.21",
|
44
|
+
"moment": "^2.30.1",
|
45
|
+
"moment-timezone": "^0.5.44",
|
42
46
|
"prop-types": "^15.7.2",
|
43
|
-
"react-bootstrap": "
|
47
|
+
"react-bootstrap": ">=2.9.2",
|
44
48
|
"react-bootstrap-range-slider": "^3.0.8",
|
49
|
+
"react-bootstrap-typeahead": "^6.3.2",
|
45
50
|
"react-dnd": "^11.1.3",
|
46
51
|
"react-dnd-html5-backend": "^11.1.3",
|
47
52
|
"react-draft-wysiwyg": "^1.15.0",
|
48
|
-
"react-
|
49
|
-
"react-
|
53
|
+
"react-hook-form": ">=7.45.4",
|
54
|
+
"react-icons": ">=5.0.1",
|
55
|
+
"react-imask": ">=7.0.1",
|
50
56
|
"react-intl": "^5.24.3",
|
51
57
|
"react-select": "^5.8.0",
|
52
58
|
"react-signature-canvas": "^1.0.3",
|
@@ -54,9 +60,11 @@
|
|
54
60
|
"xss": "^1.0.8"
|
55
61
|
},
|
56
62
|
"peerDependencies": {
|
63
|
+
"@hookform/error-message": ">=2.0.1",
|
57
64
|
"react": ">=18.2.0",
|
58
65
|
"react-bootstrap": ">=2.9.2",
|
59
66
|
"react-dom": ">=18.2.0",
|
67
|
+
"react-hook-form": ">=7.45.4",
|
60
68
|
"react-icons": ">=5.0.1",
|
61
69
|
"react-imask": ">=7.0.1"
|
62
70
|
},
|
package/types/index.d.ts
CHANGED
@@ -123,6 +123,7 @@ export type ToolbarItem = {
|
|
123
123
|
};
|
124
124
|
|
125
125
|
export interface SurveyBuilderProps {
|
126
|
+
surveyName?: string;
|
126
127
|
toolbarItems?: ToolbarItem[];
|
127
128
|
files?: any[];
|
128
129
|
url?: string;
|
@@ -170,6 +171,7 @@ export interface SurveyGeneratorProps {
|
|
170
171
|
backButton?: JSX.Element;
|
171
172
|
buttons?: JSX.Element;
|
172
173
|
buttonClassName?: string;
|
174
|
+
formId?: string;
|
173
175
|
}
|
174
176
|
|
175
177
|
export class ReactSurveyGenerator extends React.Component<SurveyGeneratorProps> {}
|