react-survey-builder 1.0.76 → 1.0.78

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.
@@ -7,12 +7,14 @@ var HeaderBar = function HeaderBar(_ref) {
7
7
  editModeOn = _ref.editModeOn,
8
8
  onDestroy = _ref.onDestroy,
9
9
  setAsChild = _ref.setAsChild,
10
- index = _ref.index;
10
+ index = _ref.index,
11
+ _ref$isStep = _ref.isStep,
12
+ isStep = _ref$isStep === void 0 ? false : _ref$isStep;
11
13
  return /*#__PURE__*/React.createElement(ButtonToolbar, {
12
14
  className: "d-flex toolbar-header align-items-center justify-content-between p-2"
13
15
  }, /*#__PURE__*/React.createElement(Badge, {
14
16
  bg: "secondary"
15
- }, item.text), /*#__PURE__*/React.createElement("div", {
17
+ }, item.text, isStep ? ' ' + (Number(index) + 1) : '', isStep && (item === null || item === void 0 ? void 0 : item.conditional) === true ? ' (Conditional)' : ''), /*#__PURE__*/React.createElement("div", {
16
18
  className: "toolbar-header-buttons"
17
19
  }, item.element !== 'LineBreak' && /*#__PURE__*/React.createElement(Button, {
18
20
  variant: "default",
@@ -101,6 +101,9 @@ export var Paragraph = function Paragraph(props) {
101
101
  if (props.item.italic) {
102
102
  classNames += ' italic';
103
103
  }
104
+ if (props.paragraphClassName) {
105
+ classNames += " ".concat(props.paragraphClassName);
106
+ }
104
107
  var baseClasses = 'SortableItem rfb-item';
105
108
  if (props.item.pageBreakBefore) {
106
109
  baseClasses += ' alwaysbreak';
@@ -2060,7 +2063,7 @@ export var RadioButtons = /*#__PURE__*/function (_React$Component4) {
2060
2063
  className: "form-group mb-3"
2061
2064
  }, /*#__PURE__*/React.createElement(ComponentLabel, self.props), self.props.item.options.map(function (option) {
2062
2065
  var _self$props$checkboxB, _self$props7, _self$props8, _self$props10, _self$props11;
2063
- console.log('option', option);
2066
+ // console.log('option', option);
2064
2067
  return /*#__PURE__*/React.createElement(ToggleButton, {
2065
2068
  label: option.text,
2066
2069
  type: "radio",
@@ -115,16 +115,15 @@ var SurveyElementsEdit = function SurveyElementsEdit(_ref2) {
115
115
  });
116
116
  }
117
117
  };
118
- React.useEffect(function () {
119
- if (dirty) {
120
- var thisElement = isObjectNotEmpty(element) ? _objectSpread(_objectSpread({}, element), {}, {
121
- dirty: true
122
- }) : {
123
- dirty: true
124
- };
125
- updateElement(thisElement);
126
- }
127
- }, [dirty, element]);
118
+
119
+ // React.useEffect(() => {
120
+ // if (dirty) {
121
+ // const thisElement = isObjectNotEmpty(element) ? { ...element, dirty: true } : { dirty: true };
122
+
123
+ // updateElement(thisElement);
124
+ // }
125
+ // }, [dirty, element]);
126
+
128
127
  var thisRequiredChecked = element.hasOwnProperty('required') ? element.required : false;
129
128
  var thisDefaultChecked = element.hasOwnProperty('defaultChecked') ? element.defaultChecked : false;
130
129
  var thisReadOnly = element.hasOwnProperty('readOnly') ? element.readOnly : false;
@@ -154,7 +153,11 @@ var SurveyElementsEdit = function SurveyElementsEdit(_ref2) {
154
153
  }, element.text), /*#__PURE__*/React.createElement(FaTimes, {
155
154
  className: "float-end dismiss-edit",
156
155
  onClick: manualEditModeOff
157
- })), element.hasOwnProperty('content') && (element.element === 'Header' || element.element === 'Label' || element.element === 'Paragraph' || element.element === 'ContentBody') && /*#__PURE__*/React.createElement(Form.Group, {
156
+ })), /*#__PURE__*/React.createElement("div", {
157
+ className: "clearfix"
158
+ }, /*#__PURE__*/React.createElement(Form.Label, {
159
+ className: "fw-bold"
160
+ }, "Field Id: ", element.fieldName)), element.hasOwnProperty('content') && (element.element === 'Header' || element.element === 'Label' || element.element === 'Paragraph' || element.element === 'ContentBody') && /*#__PURE__*/React.createElement(Form.Group, {
158
161
  className: "form-group mb-5"
159
162
  }, /*#__PURE__*/React.createElement(Form.Label, {
160
163
  className: "fw-bold"
@@ -595,6 +598,7 @@ var SurveyElementsEdit = function SurveyElementsEdit(_ref2) {
595
598
  type: "checkbox",
596
599
  checked: thisCheckedConditional,
597
600
  value: true,
601
+ onBlur: onUpdateElement,
598
602
  onChange: function onChange(e) {
599
603
  editElementProp('conditional', 'checked', e);
600
604
  }
@@ -690,6 +694,9 @@ var SurveyElementsEdit = function SurveyElementsEdit(_ref2) {
690
694
  canHaveOptionValue: canHaveOptionValue,
691
695
  updateElement: updateElement,
692
696
  element: element,
697
+ setElement: setElement,
698
+ dirty: dirty,
699
+ setDirty: setDirty,
693
700
  key: element === null || element === void 0 || (_element$options = element.options) === null || _element$options === void 0 ? void 0 : _element$options.length
694
701
  }));
695
702
  };
package/lib/toolbar.js CHANGED
@@ -394,57 +394,57 @@ var Toolbar = function Toolbar(_ref) {
394
394
  switch (element) {
395
395
  case 'Dropdown':
396
396
  return [{
397
- value: 'place_holder_option_1',
397
+ value: 'PLACE_HOLDER_OPTION_1',
398
398
  text: "Place holder option 1",
399
399
  key: "dropdown_option_".concat(ID.uuid())
400
400
  }, {
401
- value: 'place_holder_option_2',
401
+ value: 'PLACE_HOLDER_OPTION_2',
402
402
  text: "Place holder option 2",
403
403
  key: "dropdown_option_".concat(ID.uuid())
404
404
  }, {
405
- value: 'place_holder_option_3',
405
+ value: 'PLACE_HOLDER_OPTION_3',
406
406
  text: "Place holder option 3",
407
407
  key: "dropdown_option_".concat(ID.uuid())
408
408
  }];
409
409
  case 'Tags':
410
410
  return [{
411
- value: 'place_holder_tag_1',
411
+ value: 'PLACE_HOLDER_TAG_1',
412
412
  text: "Place holder option 1",
413
413
  key: "tags_option_".concat(ID.uuid())
414
414
  }, {
415
- value: 'place_holder_tag_2',
415
+ value: 'PLACE_HOLDER_TAG_2',
416
416
  text: "Place holder option 2",
417
417
  key: "tags_option_".concat(ID.uuid())
418
418
  }, {
419
- value: 'place_holder_tag_3',
419
+ value: 'PLACE_HOLDER_TAG_3',
420
420
  text: "Place holder option 3",
421
421
  key: "tags_option_".concat(ID.uuid())
422
422
  }];
423
423
  case 'Checkboxes':
424
424
  return [{
425
- value: 'place_holder_option_1',
425
+ value: 'PLACE_HOLDER_OPTION_1',
426
426
  text: "Place holder option 1",
427
427
  key: "checkboxes_option_".concat(ID.uuid())
428
428
  }, {
429
- value: 'place_holder_option_2',
429
+ value: 'PLACE_HOLDER_OPTION_2',
430
430
  text: "Place holder option 2",
431
431
  key: "checkboxes_option_".concat(ID.uuid())
432
432
  }, {
433
- value: 'place_holder_option_3',
433
+ value: 'PLACE_HOLDER_OPTION_3',
434
434
  text: "Place holder option 3",
435
435
  key: "checkboxes_option_".concat(ID.uuid())
436
436
  }];
437
437
  case 'RadioButtons':
438
438
  return [{
439
- value: 'place_holder_option_1',
439
+ value: 'PLACE_HOLDER_OPTION_1',
440
440
  text: "Place holder option 1",
441
441
  key: "radiobuttons_option_".concat(ID.uuid())
442
442
  }, {
443
- value: 'place_holder_option_2',
443
+ value: 'PLACE_HOLDER_OPTION_2',
444
444
  text: "Place holder option 2",
445
445
  key: "radiobuttons_option_".concat(ID.uuid())
446
446
  }, {
447
- value: 'place_holder_option_3',
447
+ value: 'PLACE_HOLDER_OPTION_3',
448
448
  text: "Place holder option 3",
449
449
  key: "radiobuttons_option_".concat(ID.uuid())
450
450
  }];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-survey-builder",
3
- "version": "1.0.76",
3
+ "version": "1.0.78",
4
4
  "description": "A complete survey builder for react.",
5
5
  "main": "lib/index.js",
6
6
  "types": "types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -141,6 +141,10 @@ export interface SurveyBuilderProps {
141
141
  saveAlways?: boolean;
142
142
  editMode?: boolean;
143
143
  renderEditForm?: (props: BaseElement) => React.ReactNode;
144
+ checkboxButtonClassName?: string;
145
+ headerClassName?: string;
146
+ labelClassName?: string;
147
+ paragraphClassName?: string;
144
148
  }
145
149
 
146
150
  export class ReactSurveyBuilder extends React.Component<SurveyBuilderProps> {}