react-form-builder-more-flexibility 1.0.47 → 1.0.50
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/dist/app.js +1 -1
- package/lib/form-elements/index.js +12 -21
- package/lib/index.js +2 -3
- package/package.json +1 -1
|
@@ -599,6 +599,16 @@ var Checkbox = /*#__PURE__*/function (_React$Component14) {
|
|
|
599
599
|
var _this11;
|
|
600
600
|
(0, _classCallCheck2["default"])(this, Checkbox);
|
|
601
601
|
_this11 = _super14.call(this, props);
|
|
602
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this11), "clickDetected", function () {
|
|
603
|
+
if (_this11.props.onCheckboxClick) {
|
|
604
|
+
_this11.props.onCheckboxClick(_this11.props.data); // Pass the field name or data to the parent component
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this11), "handleLabelClick", function (event) {
|
|
608
|
+
if (_this11.props.data && _this11.props.data.hasPopUp) {
|
|
609
|
+
_this11.clickDetected();
|
|
610
|
+
}
|
|
611
|
+
});
|
|
602
612
|
_this11.inputField = /*#__PURE__*/_react["default"].createRef();
|
|
603
613
|
return _this11;
|
|
604
614
|
}
|
|
@@ -620,31 +630,13 @@ var Checkbox = /*#__PURE__*/function (_React$Component14) {
|
|
|
620
630
|
if (this.props.read_only) {
|
|
621
631
|
props.disabled = 'disabled';
|
|
622
632
|
}
|
|
623
|
-
var hasPopUpBody;
|
|
624
|
-
if (this.props.data && this.props.data.hasPopUp) {
|
|
625
|
-
hasPopUpBody = true;
|
|
626
|
-
}
|
|
627
|
-
function clickDetected() {
|
|
628
|
-
console.log('CLICK DETECTED!!');
|
|
629
|
-
if (this.props.onCheckboxClick) {
|
|
630
|
-
this.props.onCheckboxClick(this.props.data); // Pass the field name or data to the parent component
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
function handleLabelClick(event) {
|
|
634
|
-
event.preventDefault();
|
|
635
|
-
if (hasPopUpBody) {
|
|
636
|
-
clickDetected();
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
633
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
640
634
|
style: _objectSpread({}, this.props.style),
|
|
641
635
|
className: baseClasses
|
|
642
636
|
}, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement("div", {
|
|
643
637
|
className: "form-group"
|
|
644
638
|
}, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({
|
|
645
|
-
passUpClick:
|
|
646
|
-
return clickDetected();
|
|
647
|
-
},
|
|
639
|
+
passUpClick: this.clickDetected,
|
|
648
640
|
className: "form-label"
|
|
649
641
|
}, this.props)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
650
642
|
className: "form-check form-check-inline"
|
|
@@ -653,8 +645,7 @@ var Checkbox = /*#__PURE__*/function (_React$Component14) {
|
|
|
653
645
|
id: this.props.data.field_name
|
|
654
646
|
}, props)), /*#__PURE__*/_react["default"].createElement("label", {
|
|
655
647
|
className: "form-check-label",
|
|
656
|
-
onClick: handleLabelClick,
|
|
657
|
-
htmlFor: this.props.data.field_name,
|
|
648
|
+
onClick: this.handleLabelClick,
|
|
658
649
|
dangerouslySetInnerHTML: {
|
|
659
650
|
__html: this.props.data.boxLabel
|
|
660
651
|
}
|
package/lib/index.js
CHANGED
|
@@ -126,11 +126,10 @@ var ReactFormBuilder = exports.ReactFormBuilder = /*#__PURE__*/function (_React$
|
|
|
126
126
|
function ReactFormGenerator(props) {
|
|
127
127
|
var language = props.locale ? props.locale : 'en';
|
|
128
128
|
var currentAppLocale = _languageProvider["default"][language];
|
|
129
|
-
var handleCheckboxClick = function handleCheckboxClick(fieldName
|
|
130
|
-
console.log("Checkbox clicked: ".concat(fieldName, ", Checked: ").concat(isChecked));
|
|
129
|
+
var handleCheckboxClick = function handleCheckboxClick(fieldName) {
|
|
131
130
|
// Handle the checkbox click event here or pass it up to a parent
|
|
132
131
|
if (props.onCheckboxClick) {
|
|
133
|
-
props.onCheckboxClick(fieldName
|
|
132
|
+
props.onCheckboxClick(fieldName);
|
|
134
133
|
}
|
|
135
134
|
};
|
|
136
135
|
return /*#__PURE__*/_react["default"].createElement(_reactIntl.IntlProvider, {
|