react-survey-builder 1.0.7 → 1.0.9
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 +19 -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 +54 -52
- package/lib/index.js +6 -4
- package/lib/language-provider/IntlMessages.js +2 -2
- package/lib/language-provider/index.js +1 -15
- package/lib/language-provider/locales/en-us.json +9 -8
- 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 +293 -153
- package/lib/survey-elements-edit.js +175 -262
- package/lib/survey-validator.js +9 -9
- package/lib/toolbar-group-item.js +4 -2
- package/lib/toolbar.js +125 -82
- package/package.json +7 -3
- package/types/index.d.ts +29 -21
- package/lib/language-provider/entries/it-it.js +0 -16
- package/lib/language-provider/entries/vi-vn.js +0 -16
- package/lib/language-provider/locales/it-it.json +0 -92
- package/lib/language-provider/locales/vi-vn.json +0 -82
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,14 @@ 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,
|
169
|
+
showLabelLocationPicker: true
|
166
170
|
}, {
|
167
171
|
key: 'Tags',
|
168
172
|
canHaveAnswer: true,
|
@@ -173,11 +177,12 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
173
177
|
label: intl.formatMessage({
|
174
178
|
id: 'place-holder-label'
|
175
179
|
}),
|
176
|
-
|
180
|
+
fieldName: 'tags_',
|
177
181
|
showCustomName: true,
|
178
182
|
showDescription: true,
|
179
183
|
showHelp: true,
|
180
|
-
options: []
|
184
|
+
options: [],
|
185
|
+
hideRequiredAlert: true
|
181
186
|
}, {
|
182
187
|
key: 'Checkboxes',
|
183
188
|
canHaveAnswer: true,
|
@@ -188,11 +193,12 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
188
193
|
label: intl.formatMessage({
|
189
194
|
id: 'place-holder-label'
|
190
195
|
}),
|
191
|
-
|
196
|
+
fieldName: 'checkboxes_',
|
192
197
|
showCustomName: true,
|
193
198
|
showDescription: true,
|
194
199
|
showHelp: true,
|
195
|
-
options: []
|
200
|
+
options: [],
|
201
|
+
hideRequiredAlert: true
|
196
202
|
}, {
|
197
203
|
key: 'Checkbox',
|
198
204
|
canHaveAnswer: true,
|
@@ -203,11 +209,12 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
203
209
|
label: intl.formatMessage({
|
204
210
|
id: 'place-holder-label'
|
205
211
|
}),
|
206
|
-
|
212
|
+
fieldName: 'checkbox_',
|
207
213
|
showCustomName: true,
|
208
214
|
showDescription: true,
|
209
215
|
showHelp: true,
|
210
|
-
boxLabel: 'Agree To Rules & Regs'
|
216
|
+
boxLabel: 'Agree To Rules & Regs',
|
217
|
+
hideRequiredAlert: true
|
211
218
|
}, {
|
212
219
|
key: 'RadioButtons',
|
213
220
|
canHaveAnswer: true,
|
@@ -218,11 +225,12 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
218
225
|
label: intl.formatMessage({
|
219
226
|
id: 'place-holder-label'
|
220
227
|
}),
|
221
|
-
|
228
|
+
fieldName: 'radiobuttons_',
|
222
229
|
showCustomName: true,
|
223
230
|
showDescription: true,
|
224
231
|
showHelp: true,
|
225
|
-
options: []
|
232
|
+
options: [],
|
233
|
+
hideRequiredAlert: true
|
226
234
|
}, {
|
227
235
|
key: 'TextInput',
|
228
236
|
canHaveAnswer: true,
|
@@ -233,10 +241,15 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
233
241
|
id: 'place-holder-label'
|
234
242
|
}),
|
235
243
|
icon: _fa.FaFont,
|
236
|
-
|
244
|
+
fieldName: 'text_input_',
|
237
245
|
showCustomName: true,
|
238
246
|
showDescription: true,
|
239
|
-
showHelp: true
|
247
|
+
showHelp: true,
|
248
|
+
placeholder: intl.formatMessage({
|
249
|
+
id: 'place-holder-label'
|
250
|
+
}),
|
251
|
+
hideRequiredAlert: true,
|
252
|
+
showLabelLocationPicker: true
|
240
253
|
}, {
|
241
254
|
key: 'EmailInput',
|
242
255
|
canHaveAnswer: true,
|
@@ -247,11 +260,15 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
247
260
|
id: 'place-holder-email'
|
248
261
|
}),
|
249
262
|
icon: _fa.FaEnvelope,
|
250
|
-
|
263
|
+
fieldName: 'email_input_',
|
251
264
|
showCustomName: true,
|
252
265
|
showDescription: true,
|
253
266
|
showHelp: true,
|
254
|
-
placeholder:
|
267
|
+
placeholder: intl.formatMessage({
|
268
|
+
id: 'place-holder-email'
|
269
|
+
}),
|
270
|
+
hideRequiredAlert: true,
|
271
|
+
showLabelLocationPicker: true
|
255
272
|
}, {
|
256
273
|
key: 'NumberInput',
|
257
274
|
canHaveAnswer: true,
|
@@ -262,13 +279,15 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
262
279
|
id: 'place-holder-label'
|
263
280
|
}),
|
264
281
|
icon: _fa.FaPlus,
|
265
|
-
|
282
|
+
fieldName: 'number_input_',
|
266
283
|
showCustomName: true,
|
267
284
|
showDescription: true,
|
268
285
|
showHelp: true,
|
269
286
|
step: 1,
|
270
|
-
|
271
|
-
|
287
|
+
minValue: 0,
|
288
|
+
maxValue: 5,
|
289
|
+
hideRequiredAlert: true,
|
290
|
+
showLabelLocationPicker: true
|
272
291
|
}, {
|
273
292
|
key: 'PhoneNumber',
|
274
293
|
canHaveAnswer: true,
|
@@ -279,10 +298,12 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
279
298
|
id: 'place-holder-phone-number'
|
280
299
|
}),
|
281
300
|
icon: _fa.FaPhone,
|
282
|
-
|
301
|
+
fieldName: 'phone_input_',
|
283
302
|
showCustomName: true,
|
284
303
|
showDescription: true,
|
285
|
-
showHelp: true
|
304
|
+
showHelp: true,
|
305
|
+
hideRequiredAlert: true,
|
306
|
+
showLabelLocationPicker: true
|
286
307
|
}, {
|
287
308
|
key: 'TextArea',
|
288
309
|
canHaveAnswer: true,
|
@@ -293,10 +314,12 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
293
314
|
id: 'place-holder-label'
|
294
315
|
}),
|
295
316
|
icon: _fa.FaTextHeight,
|
296
|
-
|
317
|
+
fieldName: 'text_area_',
|
297
318
|
showCustomName: true,
|
298
319
|
showDescription: true,
|
299
|
-
showHelp: true
|
320
|
+
showHelp: true,
|
321
|
+
hideRequiredAlert: true,
|
322
|
+
showLabelLocationPicker: true
|
300
323
|
}, {
|
301
324
|
key: 'FieldSet',
|
302
325
|
canHaveAnswer: false,
|
@@ -307,7 +330,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
307
330
|
id: 'fieldset'
|
308
331
|
}),
|
309
332
|
icon: _fa.FaBars,
|
310
|
-
|
333
|
+
fieldName: 'fieldset-element'
|
311
334
|
}, {
|
312
335
|
key: 'TwoColumnRow',
|
313
336
|
canHaveAnswer: false,
|
@@ -316,7 +339,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
316
339
|
}),
|
317
340
|
label: '',
|
318
341
|
icon: _fa.FaColumns,
|
319
|
-
|
342
|
+
fieldName: 'two_col_row_'
|
320
343
|
}, {
|
321
344
|
key: 'ThreeColumnRow',
|
322
345
|
canHaveAnswer: false,
|
@@ -325,7 +348,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
325
348
|
}),
|
326
349
|
label: '',
|
327
350
|
icon: _fa.FaColumns,
|
328
|
-
|
351
|
+
fieldName: 'three_col_row_'
|
329
352
|
}, {
|
330
353
|
key: 'FourColumnRow',
|
331
354
|
element: 'MultiColumnRow',
|
@@ -335,9 +358,9 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
335
358
|
}),
|
336
359
|
label: '',
|
337
360
|
icon: _fa.FaColumns,
|
338
|
-
|
339
|
-
|
340
|
-
|
361
|
+
fieldName: 'four_col_row_',
|
362
|
+
colCount: 4,
|
363
|
+
className: 'col-md-3'
|
341
364
|
}, {
|
342
365
|
key: 'FiveColumnRow',
|
343
366
|
element: 'MultiColumnRow',
|
@@ -347,9 +370,9 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
347
370
|
}),
|
348
371
|
label: '',
|
349
372
|
icon: _fa.FaColumns,
|
350
|
-
|
351
|
-
|
352
|
-
|
373
|
+
fieldName: 'five_col_row_',
|
374
|
+
colCount: 5,
|
375
|
+
className: 'col'
|
353
376
|
}, {
|
354
377
|
key: 'SixColumnRow',
|
355
378
|
element: 'MultiColumnRow',
|
@@ -359,9 +382,9 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
359
382
|
}),
|
360
383
|
label: '',
|
361
384
|
icon: _fa.FaColumns,
|
362
|
-
|
363
|
-
|
364
|
-
|
385
|
+
fieldName: 'six_col_row_',
|
386
|
+
colCount: 6,
|
387
|
+
className: 'col-md-2'
|
365
388
|
}, {
|
366
389
|
key: 'Image',
|
367
390
|
name: intl.formatMessage({
|
@@ -369,7 +392,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
369
392
|
}),
|
370
393
|
label: '',
|
371
394
|
icon: _fa.FaRegImage,
|
372
|
-
|
395
|
+
fieldName: 'image_',
|
373
396
|
src: ''
|
374
397
|
}, {
|
375
398
|
key: 'Rating',
|
@@ -381,7 +404,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
381
404
|
id: 'place-holder-label'
|
382
405
|
}),
|
383
406
|
icon: _fa.FaStar,
|
384
|
-
|
407
|
+
fieldName: 'rating_',
|
385
408
|
showCustomName: true,
|
386
409
|
showDescription: true,
|
387
410
|
showHelp: true
|
@@ -401,10 +424,11 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
401
424
|
label: intl.formatMessage({
|
402
425
|
id: 'place-holder-label'
|
403
426
|
}),
|
404
|
-
|
427
|
+
fieldName: 'date_picker_',
|
405
428
|
showCustomName: true,
|
406
429
|
showDescription: true,
|
407
|
-
showHelp: true
|
430
|
+
showHelp: true,
|
431
|
+
hideRequiredAlert: true
|
408
432
|
}, {
|
409
433
|
key: 'Signature',
|
410
434
|
canReadOnly: true,
|
@@ -415,7 +439,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
415
439
|
label: intl.formatMessage({
|
416
440
|
id: 'signature'
|
417
441
|
}),
|
418
|
-
|
442
|
+
fieldName: 'signature_'
|
419
443
|
}, {
|
420
444
|
key: 'HyperLink',
|
421
445
|
name: intl.formatMessage({
|
@@ -437,8 +461,8 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
437
461
|
content: intl.formatMessage({
|
438
462
|
id: 'place-holder-file-name'
|
439
463
|
}),
|
440
|
-
|
441
|
-
|
464
|
+
fieldName: 'download_',
|
465
|
+
filePath: '',
|
442
466
|
_href: ''
|
443
467
|
}, {
|
444
468
|
key: 'Range',
|
@@ -449,20 +473,21 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
449
473
|
label: intl.formatMessage({
|
450
474
|
id: 'place-holder-label'
|
451
475
|
}),
|
452
|
-
|
476
|
+
fieldName: 'range_',
|
453
477
|
step: 1,
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
478
|
+
defaultValue: 3,
|
479
|
+
minValue: 1,
|
480
|
+
maxValue: 5,
|
481
|
+
minLabel: intl.formatMessage({
|
458
482
|
id: 'easy'
|
459
483
|
}),
|
460
|
-
|
484
|
+
maxLabel: intl.formatMessage({
|
461
485
|
id: 'difficult'
|
462
486
|
}),
|
463
487
|
showCustomName: true,
|
464
488
|
showDescription: true,
|
465
|
-
showHelp: true
|
489
|
+
showHelp: true,
|
490
|
+
hideRequiredAlert: true
|
466
491
|
}, {
|
467
492
|
key: 'Camera',
|
468
493
|
name: intl.formatMessage({
|
@@ -472,7 +497,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
472
497
|
label: intl.formatMessage({
|
473
498
|
id: 'place-holder-label'
|
474
499
|
}),
|
475
|
-
|
500
|
+
fieldName: 'camera_'
|
476
501
|
}, {
|
477
502
|
key: 'FileUpload',
|
478
503
|
name: intl.formatMessage({
|
@@ -482,7 +507,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
482
507
|
label: intl.formatMessage({
|
483
508
|
id: 'place-holder-label'
|
484
509
|
}),
|
485
|
-
|
510
|
+
fieldName: 'file_upload_'
|
486
511
|
}];
|
487
512
|
}
|
488
513
|
}, {
|
@@ -492,7 +517,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
492
517
|
var customOptions = _objectSpread(_objectSpread({}, item), elementOptions);
|
493
518
|
customOptions.custom = true;
|
494
519
|
customOptions.component = item.component || null;
|
495
|
-
customOptions.
|
520
|
+
customOptions.customOptions = item.customOptions || [];
|
496
521
|
return customOptions;
|
497
522
|
}
|
498
523
|
return elementOptions;
|
@@ -506,19 +531,21 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
506
531
|
id: _UUID["default"].uuid(),
|
507
532
|
element: element,
|
508
533
|
text: item.name,
|
509
|
-
|
534
|
+
groupName: item.groupName,
|
510
535
|
"static": item["static"],
|
511
536
|
required: false,
|
512
|
-
showDescription: item.showDescription
|
537
|
+
showDescription: item.showDescription,
|
538
|
+
hideRequiredAlert: item.hideRequiredAlert
|
513
539
|
});
|
514
540
|
if (this.props.showDescription === true && !item["static"]) {
|
515
541
|
elementOptions.showDescription = true;
|
516
542
|
}
|
517
543
|
|
518
544
|
// add placeholder to form input
|
519
|
-
if (['NumberInput', 'EmailInput', 'TextInput', 'PhoneNumber', 'TextArea', 'DatePicker'].indexOf(element) !== -1) {
|
545
|
+
if (['NumberInput', 'EmailInput', 'TextInput', 'PhoneNumber', 'TextArea', 'DatePicker', 'Dropdown'].indexOf(element) !== -1) {
|
520
546
|
elementOptions.showPlaceholder = true;
|
521
547
|
}
|
548
|
+
elementOptions.placeholder = item.placeholder;
|
522
549
|
if (item.type === 'custom') {
|
523
550
|
elementOptions.key = item.key;
|
524
551
|
elementOptions.custom = true;
|
@@ -526,16 +553,19 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
526
553
|
elementOptions.bare = item.bare;
|
527
554
|
elementOptions.props = item.props;
|
528
555
|
elementOptions.component = item.component || null;
|
529
|
-
elementOptions.
|
556
|
+
elementOptions.customOptions = item.customOptions || [];
|
530
557
|
}
|
531
558
|
if (item["static"]) {
|
532
559
|
elementOptions.bold = false;
|
533
560
|
elementOptions.italic = false;
|
534
561
|
}
|
535
562
|
elementOptions.showCustomName = item.showCustomName;
|
536
|
-
elementOptions.
|
563
|
+
elementOptions.customName = item.customName;
|
564
|
+
elementOptions.showLabelLocationPicker = item.showLabelLocationPicker;
|
565
|
+
elementOptions.labelLocation = item.labelLocation;
|
537
566
|
elementOptions.showHelp = item.showHelp;
|
538
567
|
elementOptions.help = item.help;
|
568
|
+
elementOptions.hideRequiredAlert = item.hideRequiredAlert;
|
539
569
|
if (item.canHaveAnswer) {
|
540
570
|
elementOptions.canHaveAnswer = item.canHaveAnswer;
|
541
571
|
}
|
@@ -563,8 +593,8 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
563
593
|
elementOptions.canHaveOptionCorrect = item.canHaveOptionCorrect !== false;
|
564
594
|
elementOptions.canHaveOptionValue = item.canHaveOptionValue !== false;
|
565
595
|
elementOptions.canPopulateFromApi = item.canPopulateFromApi !== false;
|
566
|
-
if (item.
|
567
|
-
elementOptions.
|
596
|
+
if (item.className) {
|
597
|
+
elementOptions.className = item.className;
|
568
598
|
}
|
569
599
|
if (element === 'Image') {
|
570
600
|
elementOptions.src = item.src;
|
@@ -578,32 +608,35 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
578
608
|
}
|
579
609
|
if (element === 'Download') {
|
580
610
|
elementOptions._href = item._href;
|
581
|
-
elementOptions.
|
611
|
+
elementOptions.filePath = item.filePath;
|
582
612
|
}
|
583
613
|
if (element === 'NumberInput') {
|
584
614
|
elementOptions.step = item.step;
|
585
|
-
elementOptions.
|
586
|
-
elementOptions.
|
615
|
+
elementOptions.minValue = item.minValue;
|
616
|
+
elementOptions.maxValue = item.maxValue;
|
587
617
|
}
|
588
618
|
if (element === 'Range') {
|
589
619
|
elementOptions.step = item.step;
|
590
|
-
elementOptions.
|
591
|
-
elementOptions.
|
592
|
-
elementOptions.
|
593
|
-
elementOptions.
|
594
|
-
elementOptions.
|
620
|
+
elementOptions.defaultValue = item.defaultValue;
|
621
|
+
elementOptions.minValue = item.minValue;
|
622
|
+
elementOptions.maxValue = item.maxValue;
|
623
|
+
elementOptions.minLabel = item.minLabel;
|
624
|
+
elementOptions.maxLabel = item.maxLabel;
|
595
625
|
}
|
596
626
|
if (element === 'MultiColumnRow') {
|
597
|
-
elementOptions.
|
627
|
+
elementOptions.colCount = item.colCount;
|
598
628
|
}
|
599
629
|
if (item.defaultValue) {
|
600
630
|
elementOptions.defaultValue = item.defaultValue;
|
601
631
|
}
|
602
|
-
if (item.
|
603
|
-
elementOptions.
|
632
|
+
if (item.fieldName) {
|
633
|
+
elementOptions.fieldName = item.fieldName + _UUID["default"].uuid();
|
634
|
+
}
|
635
|
+
if (item.customName) {
|
636
|
+
elementOptions.fieldName = item.customName;
|
604
637
|
}
|
605
638
|
if (item.label) {
|
606
|
-
elementOptions.label = item.label;
|
639
|
+
elementOptions.label = item.label.trim();
|
607
640
|
}
|
608
641
|
if (item.options) {
|
609
642
|
if (item.options.length > 0) {
|
@@ -632,8 +665,9 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
632
665
|
items = _buildGroupItems.items,
|
633
666
|
grouped = _buildGroupItems.grouped,
|
634
667
|
groupKeys = _buildGroupItems.groupKeys;
|
635
|
-
return /*#__PURE__*/_react["default"].createElement(
|
636
|
-
|
668
|
+
return /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Col, {
|
669
|
+
md: 3,
|
670
|
+
className: "react-survey-builder-toolbar"
|
637
671
|
}, /*#__PURE__*/_react["default"].createElement("h4", null, this.props.intl.formatMessage({
|
638
672
|
id: 'toolbox'
|
639
673
|
})), /*#__PURE__*/_react["default"].createElement("ul", null, items.map(this.renderItem), groupKeys.map(function (k) {
|
@@ -696,10 +730,19 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
696
730
|
id: 'place-holder-option-1'
|
697
731
|
}),
|
698
732
|
key: "checkboxes_option_".concat(_UUID["default"].uuid())
|
699
|
-
}
|
700
|
-
|
701
|
-
|
702
|
-
|
733
|
+
}, {
|
734
|
+
value: 'place_holder_option_2',
|
735
|
+
text: intl.formatMessage({
|
736
|
+
id: 'place-holder-option-2'
|
737
|
+
}),
|
738
|
+
key: "checkboxes_option_".concat(_UUID["default"].uuid())
|
739
|
+
}, {
|
740
|
+
value: 'place_holder_option_3',
|
741
|
+
text: intl.formatMessage({
|
742
|
+
id: 'place-holder-option-3'
|
743
|
+
}),
|
744
|
+
key: "checkboxes_option_".concat(_UUID["default"].uuid())
|
745
|
+
}];
|
703
746
|
case 'RadioButtons':
|
704
747
|
return [{
|
705
748
|
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.9",
|
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",
|