Skip to content

Commit 640c572

Browse files
committed
Bump version to 2.11.0 and update dist files
1 parent b9c8614 commit 640c572

File tree

5 files changed

+35
-17
lines changed

5 files changed

+35
-17
lines changed

dist/react-json-form.cjs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,10 @@ function FormInput(_ref) {
882882
let wrapperProps = {};
883883
if (props.type == 'hidden') wrapperProps['style'] = {
884884
display: 'none'
885-
};
885+
}; // readonly inputs are automatically marked disabled
886+
// if this is undesired, explicitly pass disabled=false
887+
888+
if (props.readOnly && (props.disabled === undefined || props.disabled === null)) props.disabled = true;
886889
return /*#__PURE__*/React__default["default"].createElement("div", wrapperProps, /*#__PURE__*/React__default["default"].createElement(Label, {
887890
label: label,
888891
required: props.required
@@ -1063,7 +1066,7 @@ class FormMultiSelectInput extends React__default["default"].Component {
10631066

10641067
render() {
10651068
return /*#__PURE__*/React__default["default"].createElement("div", {
1066-
className: "rjf-multiselect-field"
1069+
className: this.props.readOnly ? "rjf-multiselect-field readonly" : "rjf-multiselect-field"
10671070
}, /*#__PURE__*/React__default["default"].createElement(FormInput, {
10681071
label: this.props.label,
10691072
help_text: this.props.help_text,
@@ -1544,7 +1547,7 @@ class FormDateTimeInput extends React__default["default"].Component {
15441547

15451548
this.showTimePicker = () => {
15461549
this.setState({
1547-
showTimePicker: true
1550+
showTimePicker: !this.props.readOnly && true
15481551
});
15491552
};
15501553

@@ -1590,14 +1593,15 @@ class FormDateTimeInput extends React__default["default"].Component {
15901593
}), /*#__PURE__*/React__default["default"].createElement("div", {
15911594
className: "rjf-datetime-field-inner"
15921595
}, /*#__PURE__*/React__default["default"].createElement("div", {
1593-
className: "rjf-datetime-field-inputs"
1596+
className: this.props.readOnly ? "rjf-datetime-field-inputs readonly" : "rjf-datetime-field-inputs"
15941597
}, /*#__PURE__*/React__default["default"].createElement("div", {
15951598
className: "rjf-datetime-field-date"
15961599
}, /*#__PURE__*/React__default["default"].createElement(FormInput, {
15971600
label: "Date",
15981601
type: "date",
15991602
value: this.state.date,
1600-
onChange: this.handleDateChange
1603+
onChange: this.handleDateChange,
1604+
readOnly: this.props.readOnly
16011605
})), /*#__PURE__*/React__default["default"].createElement("div", {
16021606
className: "rjf-datetime-field-time"
16031607
}, /*#__PURE__*/React__default["default"].createElement(FormInput, {
@@ -1606,6 +1610,7 @@ class FormDateTimeInput extends React__default["default"].Component {
16061610
value: this.state.hh + ':' + this.state.mm + ':' + this.state.ss + ' ' + this.state.ampm,
16071611
onFocus: this.showTimePicker,
16081612
readOnly: true,
1613+
disabled: this.props.readOnly || false,
16091614
inputRef: this.timeInput
16101615
}), /*#__PURE__*/React__default["default"].createElement("div", {
16111616
ref: this.timePickerContainer
@@ -1758,6 +1763,7 @@ class AutoCompleteInput extends React__default["default"].Component {
17581763
help_text: this.props.help_text,
17591764
error: this.props.error,
17601765
readOnly: true,
1766+
disabled: this.props.readOnly || false,
17611767
onClick: this.toggleOptions,
17621768
inputRef: this.input,
17631769
placeholder: this.props.placeholder,

dist/react-json-form.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-json-form.modern.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,10 @@ function FormInput(_ref) {
876876
let wrapperProps = {};
877877
if (props.type == 'hidden') wrapperProps['style'] = {
878878
display: 'none'
879-
};
879+
}; // readonly inputs are automatically marked disabled
880+
// if this is undesired, explicitly pass disabled=false
881+
882+
if (props.readOnly && (props.disabled === undefined || props.disabled === null)) props.disabled = true;
880883
return /*#__PURE__*/React$1.createElement("div", wrapperProps, /*#__PURE__*/React$1.createElement(Label, {
881884
label: label,
882885
required: props.required
@@ -1057,7 +1060,7 @@ class FormMultiSelectInput extends React$1.Component {
10571060

10581061
render() {
10591062
return /*#__PURE__*/React$1.createElement("div", {
1060-
className: "rjf-multiselect-field"
1063+
className: this.props.readOnly ? "rjf-multiselect-field readonly" : "rjf-multiselect-field"
10611064
}, /*#__PURE__*/React$1.createElement(FormInput, {
10621065
label: this.props.label,
10631066
help_text: this.props.help_text,
@@ -1538,7 +1541,7 @@ class FormDateTimeInput extends React$1.Component {
15381541

15391542
this.showTimePicker = () => {
15401543
this.setState({
1541-
showTimePicker: true
1544+
showTimePicker: !this.props.readOnly && true
15421545
});
15431546
};
15441547

@@ -1584,14 +1587,15 @@ class FormDateTimeInput extends React$1.Component {
15841587
}), /*#__PURE__*/React$1.createElement("div", {
15851588
className: "rjf-datetime-field-inner"
15861589
}, /*#__PURE__*/React$1.createElement("div", {
1587-
className: "rjf-datetime-field-inputs"
1590+
className: this.props.readOnly ? "rjf-datetime-field-inputs readonly" : "rjf-datetime-field-inputs"
15881591
}, /*#__PURE__*/React$1.createElement("div", {
15891592
className: "rjf-datetime-field-date"
15901593
}, /*#__PURE__*/React$1.createElement(FormInput, {
15911594
label: "Date",
15921595
type: "date",
15931596
value: this.state.date,
1594-
onChange: this.handleDateChange
1597+
onChange: this.handleDateChange,
1598+
readOnly: this.props.readOnly
15951599
})), /*#__PURE__*/React$1.createElement("div", {
15961600
className: "rjf-datetime-field-time"
15971601
}, /*#__PURE__*/React$1.createElement(FormInput, {
@@ -1600,6 +1604,7 @@ class FormDateTimeInput extends React$1.Component {
16001604
value: this.state.hh + ':' + this.state.mm + ':' + this.state.ss + ' ' + this.state.ampm,
16011605
onFocus: this.showTimePicker,
16021606
readOnly: true,
1607+
disabled: this.props.readOnly || false,
16031608
inputRef: this.timeInput
16041609
}), /*#__PURE__*/React$1.createElement("div", {
16051610
ref: this.timePickerContainer
@@ -1752,6 +1757,7 @@ class AutoCompleteInput extends React$1.Component {
17521757
help_text: this.props.help_text,
17531758
error: this.props.error,
17541759
readOnly: true,
1760+
disabled: this.props.readOnly || false,
17551761
onClick: this.toggleOptions,
17561762
inputRef: this.input,
17571763
placeholder: this.props.placeholder,

dist/react-json-form.module.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,10 @@ function FormInput(_ref) {
876876
let wrapperProps = {};
877877
if (props.type == 'hidden') wrapperProps['style'] = {
878878
display: 'none'
879-
};
879+
}; // readonly inputs are automatically marked disabled
880+
// if this is undesired, explicitly pass disabled=false
881+
882+
if (props.readOnly && (props.disabled === undefined || props.disabled === null)) props.disabled = true;
880883
return /*#__PURE__*/React$1.createElement("div", wrapperProps, /*#__PURE__*/React$1.createElement(Label, {
881884
label: label,
882885
required: props.required
@@ -1057,7 +1060,7 @@ class FormMultiSelectInput extends React$1.Component {
10571060

10581061
render() {
10591062
return /*#__PURE__*/React$1.createElement("div", {
1060-
className: "rjf-multiselect-field"
1063+
className: this.props.readOnly ? "rjf-multiselect-field readonly" : "rjf-multiselect-field"
10611064
}, /*#__PURE__*/React$1.createElement(FormInput, {
10621065
label: this.props.label,
10631066
help_text: this.props.help_text,
@@ -1538,7 +1541,7 @@ class FormDateTimeInput extends React$1.Component {
15381541

15391542
this.showTimePicker = () => {
15401543
this.setState({
1541-
showTimePicker: true
1544+
showTimePicker: !this.props.readOnly && true
15421545
});
15431546
};
15441547

@@ -1584,14 +1587,15 @@ class FormDateTimeInput extends React$1.Component {
15841587
}), /*#__PURE__*/React$1.createElement("div", {
15851588
className: "rjf-datetime-field-inner"
15861589
}, /*#__PURE__*/React$1.createElement("div", {
1587-
className: "rjf-datetime-field-inputs"
1590+
className: this.props.readOnly ? "rjf-datetime-field-inputs readonly" : "rjf-datetime-field-inputs"
15881591
}, /*#__PURE__*/React$1.createElement("div", {
15891592
className: "rjf-datetime-field-date"
15901593
}, /*#__PURE__*/React$1.createElement(FormInput, {
15911594
label: "Date",
15921595
type: "date",
15931596
value: this.state.date,
1594-
onChange: this.handleDateChange
1597+
onChange: this.handleDateChange,
1598+
readOnly: this.props.readOnly
15951599
})), /*#__PURE__*/React$1.createElement("div", {
15961600
className: "rjf-datetime-field-time"
15971601
}, /*#__PURE__*/React$1.createElement(FormInput, {
@@ -1600,6 +1604,7 @@ class FormDateTimeInput extends React$1.Component {
16001604
value: this.state.hh + ':' + this.state.mm + ':' + this.state.ss + ' ' + this.state.ampm,
16011605
onFocus: this.showTimePicker,
16021606
readOnly: true,
1607+
disabled: this.props.readOnly || false,
16031608
inputRef: this.timeInput
16041609
}), /*#__PURE__*/React$1.createElement("div", {
16051610
ref: this.timePickerContainer
@@ -1752,6 +1757,7 @@ class AutoCompleteInput extends React$1.Component {
17521757
help_text: this.props.help_text,
17531758
error: this.props.error,
17541759
readOnly: true,
1760+
disabled: this.props.readOnly || false,
17551761
onClick: this.toggleOptions,
17561762
inputRef: this.input,
17571763
placeholder: this.props.placeholder,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bhch/react-json-form",
3-
"version": "2.10.0",
3+
"version": "2.11.0",
44
"description": "Create forms using JSON Schema",
55
"publishConfig": {
66
"access": "public"

0 commit comments

Comments
 (0)