react-form-builder-more-flexibility 1.0.0

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.
Files changed (47) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +248 -0
  3. package/dist/1.app.js +1 -0
  4. package/dist/app.css +38 -0
  5. package/dist/app.js +71 -0
  6. package/lib/ItemTypes.js +11 -0
  7. package/lib/UUID.js +71 -0
  8. package/lib/dynamic-option-list.js +207 -0
  9. package/lib/form-dynamic-edit.js +74 -0
  10. package/lib/form-elements/component-drag-handle.js +114 -0
  11. package/lib/form-elements/component-drag-layer.js +85 -0
  12. package/lib/form-elements/component-drag-preview.js +74 -0
  13. package/lib/form-elements/component-header.js +35 -0
  14. package/lib/form-elements/component-label.js +31 -0
  15. package/lib/form-elements/custom-element.js +102 -0
  16. package/lib/form-elements/date-picker.js +220 -0
  17. package/lib/form-elements/header-bar.js +68 -0
  18. package/lib/form-elements/index.js +1450 -0
  19. package/lib/form-elements/myxss.js +33 -0
  20. package/lib/form-elements/star-rating.js +364 -0
  21. package/lib/form-elements-edit.js +737 -0
  22. package/lib/form-place-holder.js +70 -0
  23. package/lib/form-validator.js +121 -0
  24. package/lib/form.js +648 -0
  25. package/lib/functions/index.js +65 -0
  26. package/lib/index.js +170 -0
  27. package/lib/language-provider/IntlMessages.js +22 -0
  28. package/lib/language-provider/entries/en-us.js +23 -0
  29. package/lib/language-provider/entries/vi-vn.js +23 -0
  30. package/lib/language-provider/index.js +31 -0
  31. package/lib/language-provider/locales/en-us.json +108 -0
  32. package/lib/language-provider/locales/vi-vn.json +87 -0
  33. package/lib/multi-column/MultiColumnRow.js +175 -0
  34. package/lib/multi-column/dustbin.js +179 -0
  35. package/lib/multi-column/grip.js +60 -0
  36. package/lib/multi-column/index.js +25 -0
  37. package/lib/preview.js +455 -0
  38. package/lib/sortable-element.js +198 -0
  39. package/lib/sortable-form-elements.js +73 -0
  40. package/lib/stores/registry.js +50 -0
  41. package/lib/stores/requests.js +36 -0
  42. package/lib/stores/store.js +153 -0
  43. package/lib/toolbar-draggable-item.js +77 -0
  44. package/lib/toolbar-group-item.js +50 -0
  45. package/lib/toolbar.js +710 -0
  46. package/package.json +116 -0
  47. package/types/index.d.ts +176 -0
package/lib/toolbar.js ADDED
@@ -0,0 +1,710 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
+
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+
18
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
+
20
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
+
22
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
+
24
+ var _react = _interopRequireDefault(require("react"));
25
+
26
+ var _reactIntl = require("react-intl");
27
+
28
+ var _toolbarDraggableItem = _interopRequireDefault(require("./toolbar-draggable-item"));
29
+
30
+ var _toolbarGroupItem = _interopRequireDefault(require("./toolbar-group-item"));
31
+
32
+ var _UUID = _interopRequireDefault(require("./UUID"));
33
+
34
+ var _store = _interopRequireDefault(require("./stores/store"));
35
+
36
+ var _functions = require("./functions");
37
+
38
+ 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); }; }
39
+
40
+ 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; } }
41
+
42
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
43
+
44
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
45
+
46
+ // function isDefaultItem(item) {
47
+ // const keys = Object.keys(item);
48
+ // return keys.filter(x => x !== 'element' && x !== 'key' && x !== 'group_name').length === 0;
49
+ // }
50
+ function buildItems(items, defaultItems) {
51
+ if (!items) {
52
+ return defaultItems;
53
+ }
54
+
55
+ return items.map(function (x) {
56
+ var found = defaultItems.find(function (y) {
57
+ return x.element === y.element && y.key === x.key;
58
+ });
59
+
60
+ if (!found) {
61
+ found = defaultItems.find(function (y) {
62
+ return (x.element || x.key) === (y.element || y.key);
63
+ });
64
+ }
65
+
66
+ if (found) {
67
+ if (x.inherited !== false) {
68
+ found = _objectSpread(_objectSpread({}, found), x);
69
+ } else if (x.group_name) {
70
+ found.group_name = x.group_name;
71
+ }
72
+ }
73
+
74
+ return found || x;
75
+ });
76
+ }
77
+
78
+ function buildGroupItems(allItems) {
79
+ var items = allItems.filter(function (x) {
80
+ return !x.group_name;
81
+ });
82
+ var gItems = allItems.filter(function (x) {
83
+ return !!x.group_name;
84
+ });
85
+ var grouped = (0, _functions.groupBy)(gItems, function (x) {
86
+ return x.group_name;
87
+ });
88
+ var groupKeys = gItems.map(function (x) {
89
+ return x.group_name;
90
+ }).filter(function (v, i, self) {
91
+ return self.indexOf(v) === i;
92
+ });
93
+ return {
94
+ items: items,
95
+ grouped: grouped,
96
+ groupKeys: groupKeys
97
+ };
98
+ }
99
+
100
+ var Toolbar = /*#__PURE__*/function (_React$Component) {
101
+ (0, _inherits2["default"])(Toolbar, _React$Component);
102
+
103
+ var _super = _createSuper(Toolbar);
104
+
105
+ function Toolbar(props) {
106
+ var _this;
107
+
108
+ (0, _classCallCheck2["default"])(this, Toolbar);
109
+ _this = _super.call(this, props);
110
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderItem", function (item) {
111
+ return /*#__PURE__*/_react["default"].createElement(_toolbarDraggableItem["default"], {
112
+ data: item,
113
+ key: item.key,
114
+ onClick: _this._onClick.bind((0, _assertThisInitialized2["default"])(_this), item),
115
+ onCreate: _this.create
116
+ });
117
+ });
118
+ var intl = _this.props.intl;
119
+ var items = buildItems(props.items, _this._defaultItems(intl));
120
+ _this.state = {
121
+ items: items
122
+ };
123
+ _this.create = _this.create.bind((0, _assertThisInitialized2["default"])(_this));
124
+ return _this;
125
+ }
126
+
127
+ (0, _createClass2["default"])(Toolbar, [{
128
+ key: "componentDidMount",
129
+ value: function componentDidMount() {
130
+ var _this2 = this;
131
+
132
+ _store["default"].subscribe(function (state) {
133
+ return _this2.setState({
134
+ store: state
135
+ });
136
+ });
137
+ }
138
+ }, {
139
+ key: "_defaultItems",
140
+ value: function _defaultItems(intl) {
141
+ return [{
142
+ key: 'Header',
143
+ name: intl.formatMessage({
144
+ id: 'header-text'
145
+ }),
146
+ icon: 'fas fa-heading',
147
+ "static": true,
148
+ content: intl.formatMessage({
149
+ id: 'place-holder-text'
150
+ })
151
+ }, {
152
+ key: 'Label',
153
+ name: intl.formatMessage({
154
+ id: 'label'
155
+ }),
156
+ "static": true,
157
+ icon: 'fas fa-font',
158
+ content: intl.formatMessage({
159
+ id: 'place-holder-text'
160
+ })
161
+ }, {
162
+ key: 'Paragraph',
163
+ name: intl.formatMessage({
164
+ id: 'paragraph'
165
+ }),
166
+ "static": true,
167
+ icon: 'fas fa-paragraph',
168
+ content: intl.formatMessage({
169
+ id: 'place-holder-text'
170
+ })
171
+ }, {
172
+ key: 'LineBreak',
173
+ name: intl.formatMessage({
174
+ id: 'line-break'
175
+ }),
176
+ "static": true,
177
+ icon: 'fas fa-arrows-alt-h'
178
+ }, {
179
+ key: 'Dropdown',
180
+ canHaveAnswer: true,
181
+ name: intl.formatMessage({
182
+ id: 'dropdown'
183
+ }),
184
+ icon: 'far fa-caret-square-down',
185
+ label: intl.formatMessage({
186
+ id: 'place-holder-label'
187
+ }),
188
+ field_name: 'dropdown_',
189
+ options: []
190
+ }, {
191
+ key: 'Tags',
192
+ canHaveAnswer: true,
193
+ name: intl.formatMessage({
194
+ id: 'tags'
195
+ }),
196
+ icon: 'fas fa-tags',
197
+ label: intl.formatMessage({
198
+ id: 'place-holder-label'
199
+ }),
200
+ field_name: 'tags_',
201
+ options: []
202
+ }, {
203
+ key: 'Checkboxes',
204
+ canHaveAnswer: true,
205
+ name: intl.formatMessage({
206
+ id: 'checkboxes'
207
+ }),
208
+ icon: 'far fa-check-square',
209
+ label: intl.formatMessage({
210
+ id: 'place-holder-label'
211
+ }),
212
+ field_name: 'checkboxes_',
213
+ options: []
214
+ }, {
215
+ key: 'Checkbox',
216
+ canHaveAnswer: true,
217
+ name: intl.formatMessage({
218
+ id: 'checkbox'
219
+ }),
220
+ icon: 'far fa-check-square',
221
+ label: intl.formatMessage({
222
+ id: 'place-holder-label'
223
+ }),
224
+ field_name: 'checkbox_',
225
+ boxLabel: 'Agree To Rules & Regs'
226
+ }, {
227
+ key: 'RadioButtons',
228
+ canHaveAnswer: true,
229
+ name: intl.formatMessage({
230
+ id: 'multiple-choice'
231
+ }),
232
+ icon: 'far fa-dot-circle',
233
+ label: intl.formatMessage({
234
+ id: 'place-holder-label'
235
+ }),
236
+ field_name: 'radiobuttons_',
237
+ options: []
238
+ }, {
239
+ key: 'TextInput',
240
+ canHaveAnswer: true,
241
+ name: intl.formatMessage({
242
+ id: 'text-input'
243
+ }),
244
+ label: intl.formatMessage({
245
+ id: 'place-holder-label'
246
+ }),
247
+ icon: 'fas fa-font',
248
+ field_name: 'text_input_'
249
+ }, {
250
+ key: 'EmailInput',
251
+ canHaveAnswer: true,
252
+ name: intl.formatMessage({
253
+ id: 'email-input'
254
+ }),
255
+ label: intl.formatMessage({
256
+ id: 'place-holder-email'
257
+ }),
258
+ icon: 'fas fa-envelope',
259
+ field_name: 'email_input_',
260
+ placeholder: ''
261
+ }, {
262
+ key: 'NumberInput',
263
+ canHaveAnswer: true,
264
+ name: intl.formatMessage({
265
+ id: 'number-input'
266
+ }),
267
+ label: intl.formatMessage({
268
+ id: 'place-holder-label'
269
+ }),
270
+ icon: 'fas fa-plus',
271
+ field_name: 'number_input_'
272
+ }, {
273
+ key: 'PhoneNumber',
274
+ canHaveAnswer: true,
275
+ name: intl.formatMessage({
276
+ id: 'phone-input'
277
+ }),
278
+ label: intl.formatMessage({
279
+ id: 'place-holder-phone-number'
280
+ }),
281
+ icon: 'fas fa-phone',
282
+ field_name: 'phone_input_'
283
+ }, {
284
+ key: 'TextArea',
285
+ canHaveAnswer: true,
286
+ name: intl.formatMessage({
287
+ id: 'multi-line-input'
288
+ }),
289
+ label: intl.formatMessage({
290
+ id: 'place-holder-label'
291
+ }),
292
+ icon: 'fas fa-text-height',
293
+ field_name: 'text_area_'
294
+ }, {
295
+ key: 'TwoColumnRow',
296
+ canHaveAnswer: false,
297
+ name: intl.formatMessage({
298
+ id: 'two-columns-row'
299
+ }),
300
+ label: '',
301
+ icon: 'fas fa-columns',
302
+ field_name: 'two_col_row_'
303
+ }, {
304
+ key: 'ThreeColumnRow',
305
+ canHaveAnswer: false,
306
+ name: intl.formatMessage({
307
+ id: 'three-columns-row'
308
+ }),
309
+ label: '',
310
+ icon: 'fas fa-columns',
311
+ field_name: 'three_col_row_'
312
+ }, {
313
+ key: 'FourColumnRow',
314
+ element: 'MultiColumnRow',
315
+ canHaveAnswer: false,
316
+ name: intl.formatMessage({
317
+ id: 'four-columns-row'
318
+ }),
319
+ label: '',
320
+ icon: 'fas fa-columns',
321
+ field_name: 'four_col_row_',
322
+ col_count: 4,
323
+ class_name: 'col-md-3'
324
+ }, {
325
+ key: 'FiveColumnRow',
326
+ element: 'MultiColumnRow',
327
+ canHaveAnswer: false,
328
+ name: intl.formatMessage({
329
+ id: 'five-columns-row'
330
+ }),
331
+ label: '',
332
+ icon: 'fas fa-columns',
333
+ field_name: 'five_col_row_',
334
+ col_count: 5,
335
+ class_name: 'col'
336
+ }, {
337
+ key: 'SixColumnRow',
338
+ element: 'MultiColumnRow',
339
+ canHaveAnswer: false,
340
+ name: intl.formatMessage({
341
+ id: 'six-columns-row'
342
+ }),
343
+ label: '',
344
+ icon: 'fas fa-columns',
345
+ field_name: 'six_col_row_',
346
+ col_count: 6,
347
+ class_name: 'col-md-2'
348
+ }, {
349
+ key: 'Image',
350
+ name: intl.formatMessage({
351
+ id: 'image'
352
+ }),
353
+ label: '',
354
+ icon: 'far fa-image',
355
+ field_name: 'image_',
356
+ src: ''
357
+ }, {
358
+ key: 'Rating',
359
+ canHaveAnswer: true,
360
+ name: intl.formatMessage({
361
+ id: 'rating'
362
+ }),
363
+ label: intl.formatMessage({
364
+ id: 'place-holder-label'
365
+ }),
366
+ icon: 'fas fa-star',
367
+ field_name: 'rating_'
368
+ }, {
369
+ key: 'DatePicker',
370
+ canDefaultToday: true,
371
+ canReadOnly: true,
372
+ dateFormat: 'MM/dd/yyyy',
373
+ timeFormat: 'hh:mm aa',
374
+ showTimeSelect: false,
375
+ showTimeSelectOnly: false,
376
+ showTimeInput: false,
377
+ name: intl.formatMessage({
378
+ id: 'date'
379
+ }),
380
+ icon: 'far fa-calendar-alt',
381
+ label: intl.formatMessage({
382
+ id: 'place-holder-label'
383
+ }),
384
+ field_name: 'date_picker_'
385
+ }, {
386
+ key: 'Signature',
387
+ canReadOnly: true,
388
+ name: intl.formatMessage({
389
+ id: 'signature'
390
+ }),
391
+ icon: 'fas fa-pen-square',
392
+ label: intl.formatMessage({
393
+ id: 'signature'
394
+ }),
395
+ field_name: 'signature_'
396
+ }, {
397
+ key: 'HyperLink',
398
+ name: intl.formatMessage({
399
+ id: 'website'
400
+ }),
401
+ icon: 'fas fa-link',
402
+ "static": true,
403
+ content: intl.formatMessage({
404
+ id: 'place-holder-website-link'
405
+ }),
406
+ href: 'http://www.example.com'
407
+ }, {
408
+ key: 'Download',
409
+ name: intl.formatMessage({
410
+ id: 'file-attachment'
411
+ }),
412
+ icon: 'fas fa-file',
413
+ "static": true,
414
+ content: intl.formatMessage({
415
+ id: 'place-holder-file-name'
416
+ }),
417
+ field_name: 'download_',
418
+ file_path: '',
419
+ _href: ''
420
+ }, {
421
+ key: 'Range',
422
+ name: intl.formatMessage({
423
+ id: 'range'
424
+ }),
425
+ icon: 'fas fa-sliders-h',
426
+ label: intl.formatMessage({
427
+ id: 'place-holder-label'
428
+ }),
429
+ field_name: 'range_',
430
+ step: 1,
431
+ default_value: 3,
432
+ min_value: 1,
433
+ max_value: 5,
434
+ min_label: intl.formatMessage({
435
+ id: 'easy'
436
+ }),
437
+ max_label: intl.formatMessage({
438
+ id: 'difficult'
439
+ })
440
+ }, {
441
+ key: 'Camera',
442
+ name: intl.formatMessage({
443
+ id: 'camera'
444
+ }),
445
+ icon: 'fas fa-camera',
446
+ label: intl.formatMessage({
447
+ id: 'place-holder-label'
448
+ }),
449
+ field_name: 'camera_'
450
+ }, {
451
+ key: 'FileUpload',
452
+ name: intl.formatMessage({
453
+ id: 'file-upload'
454
+ }),
455
+ icon: 'fas fa-file',
456
+ label: intl.formatMessage({
457
+ id: 'place-holder-label'
458
+ }),
459
+ field_name: 'file_upload_'
460
+ }];
461
+ }
462
+ }, {
463
+ key: "create",
464
+ value: function create(item) {
465
+ var intl = this.props.intl;
466
+ var element = item.element || item.key;
467
+ var elementOptions = {
468
+ id: _UUID["default"].uuid(),
469
+ element: element,
470
+ text: item.name,
471
+ group_name: item.group_name,
472
+ "static": item["static"],
473
+ required: false,
474
+ showDescription: item.showDescription
475
+ };
476
+
477
+ if (this.props.showDescription === true && !item["static"]) {
478
+ elementOptions.showDescription = true;
479
+ } // add placeholder to form input
480
+
481
+
482
+ if (['NumberInput', 'EmailInput', 'TextInput', 'PhoneNumber', 'TextArea'].indexOf(element) !== -1) {
483
+ elementOptions.showPlaceholder = true;
484
+ }
485
+
486
+ if (item.type === 'custom') {
487
+ elementOptions.key = item.key;
488
+ elementOptions.custom = true;
489
+ elementOptions.forwardRef = item.forwardRef;
490
+ elementOptions.bare = item.bare;
491
+ elementOptions.props = item.props;
492
+ elementOptions.component = item.component || null;
493
+ elementOptions.custom_options = item.custom_options || [];
494
+ }
495
+
496
+ if (item["static"]) {
497
+ elementOptions.bold = false;
498
+ elementOptions.italic = false;
499
+ }
500
+
501
+ if (item.canHaveAnswer) {
502
+ elementOptions.canHaveAnswer = item.canHaveAnswer;
503
+ }
504
+
505
+ if (item.canReadOnly) {
506
+ elementOptions.readOnly = false;
507
+ }
508
+
509
+ if (item.canDefaultToday) {
510
+ elementOptions.defaultToday = false;
511
+ }
512
+
513
+ if (item.content) {
514
+ elementOptions.content = item.content;
515
+ }
516
+
517
+ if (item.href) {
518
+ elementOptions.href = item.href;
519
+ }
520
+
521
+ if (item.inherited !== undefined) {
522
+ elementOptions.inherited = item.inherited;
523
+ }
524
+
525
+ elementOptions.canHavePageBreakBefore = item.canHavePageBreakBefore !== false;
526
+ elementOptions.canHaveAlternateForm = item.canHaveAlternateForm !== false;
527
+ elementOptions.canHaveDisplayHorizontal = item.canHaveDisplayHorizontal !== false;
528
+
529
+ if (elementOptions.canHaveDisplayHorizontal) {
530
+ elementOptions.inline = item.inline;
531
+ }
532
+
533
+ elementOptions.canHaveOptionCorrect = item.canHaveOptionCorrect !== false;
534
+ elementOptions.canHaveOptionValue = item.canHaveOptionValue !== false;
535
+ elementOptions.canPopulateFromApi = item.canPopulateFromApi !== false;
536
+
537
+ if (item.class_name) {
538
+ elementOptions.class_name = item.class_name;
539
+ }
540
+
541
+ if (item.element === 'Image') {
542
+ elementOptions.src = item.src;
543
+ }
544
+
545
+ if (item.element === 'DatePicker') {
546
+ elementOptions.dateFormat = item.dateFormat;
547
+ elementOptions.timeFormat = item.timeFormat;
548
+ elementOptions.showTimeSelect = item.showTimeSelect;
549
+ elementOptions.showTimeSelectOnly = item.showTimeSelectOnly;
550
+ elementOptions.showTimeInput = item.showTimeInput;
551
+ }
552
+
553
+ if (item.element === 'Download') {
554
+ elementOptions._href = item._href;
555
+ elementOptions.file_path = item.file_path;
556
+ }
557
+
558
+ if (item.element === 'Range') {
559
+ elementOptions.step = item.step;
560
+ elementOptions.default_value = item.default_value;
561
+ elementOptions.min_value = item.min_value;
562
+ elementOptions.max_value = item.max_value;
563
+ elementOptions.min_label = item.min_label;
564
+ elementOptions.max_label = item.max_label;
565
+ }
566
+
567
+ if (item.element === 'MultiColumnRow') {
568
+ elementOptions.col_count = item.col_count;
569
+ }
570
+
571
+ if (item.defaultValue) {
572
+ elementOptions.defaultValue = item.defaultValue;
573
+ }
574
+
575
+ if (item.field_name) {
576
+ elementOptions.field_name = item.field_name + _UUID["default"].uuid();
577
+ }
578
+
579
+ if (item.label) {
580
+ elementOptions.label = item.label;
581
+ }
582
+
583
+ if (item.options) {
584
+ if (item.options.length > 0) {
585
+ elementOptions.options = item.options;
586
+ } else {
587
+ elementOptions.options = Toolbar._defaultItemOptions(elementOptions.element, intl);
588
+ }
589
+ }
590
+
591
+ return elementOptions;
592
+ }
593
+ }, {
594
+ key: "_onClick",
595
+ value: function _onClick(item) {
596
+ // ElementActions.createElement(this.create(item));
597
+ _store["default"].dispatch('create', this.create(item));
598
+ }
599
+ }, {
600
+ key: "render",
601
+ value: function render() {
602
+ var _this3 = this;
603
+
604
+ var _buildGroupItems = buildGroupItems(this.state.items),
605
+ items = _buildGroupItems.items,
606
+ grouped = _buildGroupItems.grouped,
607
+ groupKeys = _buildGroupItems.groupKeys;
608
+
609
+ return /*#__PURE__*/_react["default"].createElement("div", {
610
+ className: "col-md-3 react-form-builder-toolbar float-right"
611
+ }, /*#__PURE__*/_react["default"].createElement("h4", null, this.props.intl.formatMessage({
612
+ id: 'toolbox'
613
+ })), /*#__PURE__*/_react["default"].createElement("ul", null, items.map(this.renderItem), groupKeys.map(function (k) {
614
+ return /*#__PURE__*/_react["default"].createElement(_toolbarGroupItem["default"], {
615
+ key: k,
616
+ name: k,
617
+ group: grouped.get(k),
618
+ renderItem: _this3.renderItem
619
+ });
620
+ })));
621
+ }
622
+ }], [{
623
+ key: "_defaultItemOptions",
624
+ value: function _defaultItemOptions(element, intl) {
625
+ switch (element) {
626
+ case 'Dropdown':
627
+ return [{
628
+ value: 'place_holder_option_1',
629
+ text: intl.formatMessage({
630
+ id: 'place-holder-option-1'
631
+ }),
632
+ key: "dropdown_option_".concat(_UUID["default"].uuid())
633
+ }, {
634
+ value: 'place_holder_option_2',
635
+ text: intl.formatMessage({
636
+ id: 'place-holder-option-2'
637
+ }),
638
+ key: "dropdown_option_".concat(_UUID["default"].uuid())
639
+ }, {
640
+ value: 'place_holder_option_3',
641
+ text: intl.formatMessage({
642
+ id: 'place-holder-option-3'
643
+ }),
644
+ key: "dropdown_option_".concat(_UUID["default"].uuid())
645
+ }];
646
+
647
+ case 'Tags':
648
+ return [{
649
+ value: 'place_holder_tag_1',
650
+ text: intl.formatMessage({
651
+ id: 'place-holder-tag-1'
652
+ }),
653
+ key: "tags_option_".concat(_UUID["default"].uuid())
654
+ }, {
655
+ value: 'place_holder_tag_2',
656
+ text: intl.formatMessage({
657
+ id: 'place-holder-tag-2'
658
+ }),
659
+ key: "tags_option_".concat(_UUID["default"].uuid())
660
+ }, {
661
+ value: 'place_holder_tag_3',
662
+ text: intl.formatMessage({
663
+ id: 'place-holder-tag-3'
664
+ }),
665
+ key: "tags_option_".concat(_UUID["default"].uuid())
666
+ }];
667
+
668
+ case 'Checkboxes':
669
+ return [{
670
+ value: 'place_holder_option_1',
671
+ text: intl.formatMessage({
672
+ id: 'place-holder-option-1'
673
+ }),
674
+ key: "checkboxes_option_".concat(_UUID["default"].uuid())
675
+ } // { value: 'place_holder_option_2', text: intl.formatMessage({ id: 'place-holder-option-2' }), key: `checkboxes_option_${ID.uuid()}` },
676
+ // { value: 'place_holder_option_3', text: intl.formatMessage({ id: 'place-holder-option-3' }), key: `checkboxes_option_${ID.uuid()}` },
677
+ ];
678
+
679
+ case 'RadioButtons':
680
+ return [{
681
+ value: 'place_holder_option_1',
682
+ text: intl.formatMessage({
683
+ id: 'place-holder-option-1'
684
+ }),
685
+ key: "radiobuttons_option_".concat(_UUID["default"].uuid())
686
+ }, {
687
+ value: 'place_holder_option_2',
688
+ text: intl.formatMessage({
689
+ id: 'place-holder-option-2'
690
+ }),
691
+ key: "radiobuttons_option_".concat(_UUID["default"].uuid())
692
+ }, {
693
+ value: 'place_holder_option_3',
694
+ text: intl.formatMessage({
695
+ id: 'place-holder-option-3'
696
+ }),
697
+ key: "radiobuttons_option_".concat(_UUID["default"].uuid())
698
+ }];
699
+
700
+ default:
701
+ return [];
702
+ }
703
+ }
704
+ }]);
705
+ return Toolbar;
706
+ }(_react["default"].Component);
707
+
708
+ var _default = (0, _reactIntl.injectIntl)(Toolbar);
709
+
710
+ exports["default"] = _default;