uniforms-bootstrap4
Advanced tools
Comparing version 2.6.3 to 2.6.4
@@ -5,2 +5,6 @@ import React from 'react'; | ||
import wrapField from './wrapField'; | ||
const base64 = typeof btoa !== 'undefined' | ||
? btoa | ||
: (x) => Buffer.from(x).toString('base64'); | ||
const escape = (x) => base64(x).replace(/=+$/, ''); | ||
const Radio = props => wrapField(props, props.allowedValues.map(item => (React.createElement("div", { key: item, className: classnames(props.inputClassName, 'form-check', 'radio', { | ||
@@ -10,6 +14,6 @@ 'text-danger': props.error, | ||
}) }, | ||
React.createElement("label", { htmlFor: `${props.id}-${item}`, className: "form-check-label" }, | ||
React.createElement("input", { checked: item === props.value, className: "form-check-input", disabled: props.disabled, id: `${props.id}-${item}`, name: props.name, onChange: () => props.onChange(item), type: "radio" }), | ||
React.createElement("label", { htmlFor: `${props.id}-${escape(item)}`, className: "form-check-label" }, | ||
React.createElement("input", { checked: item === props.value, className: "form-check-input", disabled: props.disabled, id: `${props.id}-${escape(item)}`, name: props.name, onChange: () => props.onChange(item), type: "radio" }), | ||
' ', | ||
props.transform ? props.transform(item) : item))))); | ||
export default connectField(Radio); |
@@ -5,2 +5,6 @@ import React from 'react'; | ||
import wrapField from './wrapField'; | ||
const base64 = typeof btoa !== 'undefined' | ||
? btoa | ||
: (x) => Buffer.from(x).toString('base64'); | ||
const escape = (x) => base64(x).replace(/=+$/, ''); | ||
const xor = (item, array) => { | ||
@@ -14,6 +18,6 @@ const index = array.indexOf(item); | ||
const renderCheckboxes = props => props.allowedValues.map(item => (React.createElement("div", { key: item, className: classnames(props.inputClassName, `checkbox${props.inline ? '-inline' : ''}`) }, | ||
React.createElement("label", { htmlFor: `${props.id}-${item}` }, | ||
React.createElement("label", { htmlFor: `${props.id}-${escape(item)}` }, | ||
React.createElement("input", { checked: props.fieldType === Array | ||
? props.value.includes(item) | ||
: props.value === item, disabled: props.disabled, id: `${props.id}-${item}`, name: props.name, onChange: () => props.onChange(props.fieldType === Array ? xor(item, props.value) : item), type: "checkbox" }), | ||
: props.value === item, disabled: props.disabled, id: `${props.id}-${escape(item)}`, name: props.name, onChange: () => props.onChange(props.fieldType === Array ? xor(item, props.value) : item), type: "checkbox" }), | ||
props.transform ? props.transform(item) : item)))); | ||
@@ -20,0 +24,0 @@ const renderSelect = props => (React.createElement("select", { className: classnames(props.inputClassName, 'c-select form-control', { |
{ | ||
"name": "uniforms-bootstrap4", | ||
"version": "2.6.3", | ||
"version": "2.6.4", | ||
"license": "MIT", | ||
@@ -40,3 +40,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "81c554ff6cf5db9b092086c0490daaee0385b2e3" | ||
"gitHead": "6940aedcf20e21c8e7e4eb11c70cba3303e55368" | ||
} |
@@ -8,2 +8,6 @@ "use strict"; | ||
var wrapField_1 = tslib_1.__importDefault(require("./wrapField")); | ||
var base64 = typeof btoa !== 'undefined' | ||
? btoa | ||
: function (x) { return Buffer.from(x).toString('base64'); }; | ||
var escape = function (x) { return base64(x).replace(/=+$/, ''); }; | ||
var Radio = function (props) { | ||
@@ -14,4 +18,4 @@ return wrapField_1.default(props, props.allowedValues.map(function (item) { return (react_1.default.createElement("div", { key: item, className: classnames_1.default(props.inputClassName, 'form-check', 'radio', { | ||
}) }, | ||
react_1.default.createElement("label", { htmlFor: props.id + "-" + item, className: "form-check-label" }, | ||
react_1.default.createElement("input", { checked: item === props.value, className: "form-check-input", disabled: props.disabled, id: props.id + "-" + item, name: props.name, onChange: function () { return props.onChange(item); }, type: "radio" }), | ||
react_1.default.createElement("label", { htmlFor: props.id + "-" + escape(item), className: "form-check-label" }, | ||
react_1.default.createElement("input", { checked: item === props.value, className: "form-check-input", disabled: props.disabled, id: props.id + "-" + escape(item), name: props.name, onChange: function () { return props.onChange(item); }, type: "radio" }), | ||
' ', | ||
@@ -18,0 +22,0 @@ props.transform ? props.transform(item) : item))); })); |
@@ -8,2 +8,6 @@ "use strict"; | ||
var wrapField_1 = tslib_1.__importDefault(require("./wrapField")); | ||
var base64 = typeof btoa !== 'undefined' | ||
? btoa | ||
: function (x) { return Buffer.from(x).toString('base64'); }; | ||
var escape = function (x) { return base64(x).replace(/=+$/, ''); }; | ||
var xor = function (item, array) { | ||
@@ -18,6 +22,6 @@ var index = array.indexOf(item); | ||
return props.allowedValues.map(function (item) { return (react_1.default.createElement("div", { key: item, className: classnames_1.default(props.inputClassName, "checkbox" + (props.inline ? '-inline' : '')) }, | ||
react_1.default.createElement("label", { htmlFor: props.id + "-" + item }, | ||
react_1.default.createElement("label", { htmlFor: props.id + "-" + escape(item) }, | ||
react_1.default.createElement("input", { checked: props.fieldType === Array | ||
? props.value.includes(item) | ||
: props.value === item, disabled: props.disabled, id: props.id + "-" + item, name: props.name, onChange: function () { | ||
: props.value === item, disabled: props.disabled, id: props.id + "-" + escape(item), name: props.name, onChange: function () { | ||
return props.onChange(props.fieldType === Array ? xor(item, props.value) : item); | ||
@@ -24,0 +28,0 @@ }, type: "checkbox" }), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
107725
2565