Skip to content

Commit

Permalink
Bump version 2.13.4 and update dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
bhch committed Jan 12, 2024
1 parent 88a1548 commit 545e9af
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 5 deletions.
29 changes: 28 additions & 1 deletion dist/react-json-form.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,31 @@ function getKey(obj, key, default_value) {
let val = obj[key];
return typeof val !== 'undefined' ? val : default_value;
}
function choicesValueTitleMap(choices) {
/* Returns a mapping of {value: title} for the given choices.
* E.g.:
* Input: [{'title': 'One', 'value': 1}, 2]
* Output: {1: 'One', 2: 2}
*/
let map = {};

for (let i = 0; i < choices.length; i++) {
let choice = choices[i];
let value, title;

if (actualType(choice) === 'object') {
value = choice.value;
title = choice.title;
} else {
value = choice;
title = choice;
}

map[value] = title;
}

return map;
}
function valueInChoices(schema, value) {
/* Checks whether the given value is in schema choices or not.
If schema doesn't have choices, returns true.
Expand Down Expand Up @@ -1170,6 +1195,7 @@ class FormMultiSelectInput extends React__default["default"].Component {
inputRef: this.input,
onClick: this.toggleOptions,
value: this.props.value,
options: this.props.options,
onChange: this.handleChange,
disabled: this.props.readOnly,
placeholder: this.props.placeholder
Expand Down Expand Up @@ -1204,6 +1230,7 @@ class FormMultiSelectInputField extends React__default["default"].Component {
}

render() {
let valueTitleMap = choicesValueTitleMap(this.props.options);
return /*#__PURE__*/React__default["default"].createElement("div", {
className: "rjf-multiselect-field-input",
onClick: this.props.onClick,
Expand All @@ -1212,7 +1239,7 @@ class FormMultiSelectInputField extends React__default["default"].Component {
}, this.props.value.length ? this.props.value.map((item, index) => /*#__PURE__*/React__default["default"].createElement("span", {
className: "rjf-multiselect-field-input-item",
key: item + '_' + index
}, /*#__PURE__*/React__default["default"].createElement("span", null, item), this.props.disabled || /*#__PURE__*/React__default["default"].createElement("button", {
}, /*#__PURE__*/React__default["default"].createElement("span", null, valueTitleMap[item]), this.props.disabled || /*#__PURE__*/React__default["default"].createElement("button", {
title: "Remove",
type: "button",
onClick: e => this.handleRemove(e, index)
Expand Down
2 changes: 1 addition & 1 deletion dist/react-json-form.js

Large diffs are not rendered by default.

29 changes: 28 additions & 1 deletion dist/react-json-form.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,31 @@ function getKey(obj, key, default_value) {
let val = obj[key];
return typeof val !== 'undefined' ? val : default_value;
}
function choicesValueTitleMap(choices) {
/* Returns a mapping of {value: title} for the given choices.
* E.g.:
* Input: [{'title': 'One', 'value': 1}, 2]
* Output: {1: 'One', 2: 2}
*/
let map = {};

for (let i = 0; i < choices.length; i++) {
let choice = choices[i];
let value, title;

if (actualType(choice) === 'object') {
value = choice.value;
title = choice.title;
} else {
value = choice;
title = choice;
}

map[value] = title;
}

return map;
}
function valueInChoices(schema, value) {
/* Checks whether the given value is in schema choices or not.
If schema doesn't have choices, returns true.
Expand Down Expand Up @@ -1164,6 +1189,7 @@ class FormMultiSelectInput extends React$1.Component {
inputRef: this.input,
onClick: this.toggleOptions,
value: this.props.value,
options: this.props.options,
onChange: this.handleChange,
disabled: this.props.readOnly,
placeholder: this.props.placeholder
Expand Down Expand Up @@ -1198,6 +1224,7 @@ class FormMultiSelectInputField extends React$1.Component {
}

render() {
let valueTitleMap = choicesValueTitleMap(this.props.options);
return /*#__PURE__*/React$1.createElement("div", {
className: "rjf-multiselect-field-input",
onClick: this.props.onClick,
Expand All @@ -1206,7 +1233,7 @@ class FormMultiSelectInputField extends React$1.Component {
}, this.props.value.length ? this.props.value.map((item, index) => /*#__PURE__*/React$1.createElement("span", {
className: "rjf-multiselect-field-input-item",
key: item + '_' + index
}, /*#__PURE__*/React$1.createElement("span", null, item), this.props.disabled || /*#__PURE__*/React$1.createElement("button", {
}, /*#__PURE__*/React$1.createElement("span", null, valueTitleMap[item]), this.props.disabled || /*#__PURE__*/React$1.createElement("button", {
title: "Remove",
type: "button",
onClick: e => this.handleRemove(e, index)
Expand Down
29 changes: 28 additions & 1 deletion dist/react-json-form.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,31 @@ function getKey(obj, key, default_value) {
let val = obj[key];
return typeof val !== 'undefined' ? val : default_value;
}
function choicesValueTitleMap(choices) {
/* Returns a mapping of {value: title} for the given choices.
* E.g.:
* Input: [{'title': 'One', 'value': 1}, 2]
* Output: {1: 'One', 2: 2}
*/
let map = {};

for (let i = 0; i < choices.length; i++) {
let choice = choices[i];
let value, title;

if (actualType(choice) === 'object') {
value = choice.value;
title = choice.title;
} else {
value = choice;
title = choice;
}

map[value] = title;
}

return map;
}
function valueInChoices(schema, value) {
/* Checks whether the given value is in schema choices or not.
If schema doesn't have choices, returns true.
Expand Down Expand Up @@ -1164,6 +1189,7 @@ class FormMultiSelectInput extends React$1.Component {
inputRef: this.input,
onClick: this.toggleOptions,
value: this.props.value,
options: this.props.options,
onChange: this.handleChange,
disabled: this.props.readOnly,
placeholder: this.props.placeholder
Expand Down Expand Up @@ -1198,6 +1224,7 @@ class FormMultiSelectInputField extends React$1.Component {
}

render() {
let valueTitleMap = choicesValueTitleMap(this.props.options);
return /*#__PURE__*/React$1.createElement("div", {
className: "rjf-multiselect-field-input",
onClick: this.props.onClick,
Expand All @@ -1206,7 +1233,7 @@ class FormMultiSelectInputField extends React$1.Component {
}, this.props.value.length ? this.props.value.map((item, index) => /*#__PURE__*/React$1.createElement("span", {
className: "rjf-multiselect-field-input-item",
key: item + '_' + index
}, /*#__PURE__*/React$1.createElement("span", null, item), this.props.disabled || /*#__PURE__*/React$1.createElement("button", {
}, /*#__PURE__*/React$1.createElement("span", null, valueTitleMap[item]), this.props.disabled || /*#__PURE__*/React$1.createElement("button", {
title: "Remove",
type: "button",
onClick: e => this.handleRemove(e, index)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bhch/react-json-form",
"version": "2.13.3",
"version": "2.13.4",
"description": "Create forms using JSON Schema",
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit 545e9af

Please sign in to comment.