uniforms-bootstrap4
Advanced tools
Comparing version 3.10.1 to 4.0.0-alpha.0
@@ -15,2 +15,5 @@ "use strict"; | ||
const AutoField = uniforms_1.createAutoField(props => { | ||
if (props.component) { | ||
return props.component; | ||
} | ||
if (props.allowedValues) { | ||
@@ -17,0 +20,0 @@ return props.checkboxes && props.fieldType !== Array |
import { ComponentType } from 'react'; | ||
export declare type AutoFieldsProps = { | ||
autoField?: ComponentType<{ | ||
name: string; | ||
}>; | ||
element?: ComponentType | string; | ||
@@ -11,2 +8,2 @@ fields?: string[]; | ||
}; | ||
export default function AutoFields({ autoField, element, fields, omitFields, showInlineError, ...props }: AutoFieldsProps): import("react").ReactElement<{}, string | import("react").JSXElementConstructor<any>>; | ||
export default function AutoFields({ element, fields, omitFields, showInlineError, ...props }: AutoFieldsProps): import("react").ReactElement<{}, string | import("react").JSXElementConstructor<any>>; |
@@ -8,8 +8,8 @@ "use strict"; | ||
function AutoFields(_a) { | ||
var { autoField = AutoField_1.default, element = 'div', fields, omitFields = [], showInlineError } = _a, props = tslib_1.__rest(_a, ["autoField", "element", "fields", "omitFields", "showInlineError"]); | ||
var { element = react_1.Fragment, fields, omitFields = [], showInlineError } = _a, props = tslib_1.__rest(_a, ["element", "fields", "omitFields", "showInlineError"]); | ||
const { schema } = uniforms_1.useForm(); | ||
return react_1.createElement(element, props, (fields !== null && fields !== void 0 ? fields : schema.getSubfields()) | ||
.filter(field => !omitFields.includes(field)) | ||
.map(field => react_1.createElement(autoField, Object.assign({ key: field, name: field }, showInlineError === undefined ? null : { showInlineError })))); | ||
.map(field => react_1.createElement(AutoField_1.default, Object.assign({ key: field, name: field }, showInlineError === undefined ? null : { showInlineError })))); | ||
} | ||
exports.default = AutoFields; |
@@ -5,5 +5,4 @@ import { ReactNode } from 'react'; | ||
addIcon?: ReactNode; | ||
initialCount?: number; | ||
}>; | ||
declare const _default: import("uniforms").ConnectedField<ListAddFieldProps, unknown>; | ||
export default _default; |
@@ -9,6 +9,6 @@ "use strict"; | ||
function ListAdd(_a) { | ||
var { addIcon, className, disabled, initialCount, name, readOnly, value } = _a, props = tslib_1.__rest(_a, ["addIcon", "className", "disabled", "initialCount", "name", "readOnly", "value"]); | ||
var { addIcon, className, disabled, name, readOnly, value } = _a, props = tslib_1.__rest(_a, ["addIcon", "className", "disabled", "name", "readOnly", "value"]); | ||
const nameParts = uniforms_1.joinName(null, name); | ||
const parentName = uniforms_1.joinName(nameParts.slice(0, -1)); | ||
const parent = uniforms_1.useField(parentName, { initialCount }, { absoluteName: true })[0]; | ||
const parent = uniforms_1.useField(parentName, {}, { absoluteName: true })[0]; | ||
const limitNotReached = !disabled && !(parent.maxCount <= parent.value.length); | ||
@@ -15,0 +15,0 @@ function onAction(event) { |
@@ -5,3 +5,2 @@ import { ReactNode } from 'react'; | ||
addIcon?: ReactNode; | ||
initialCount?: number; | ||
itemProps?: object; | ||
@@ -8,0 +7,0 @@ removeIcon?: ReactNode; |
@@ -10,3 +10,3 @@ "use strict"; | ||
function List(_a) { | ||
var { addIcon, children = react_1.default.createElement(ListItemField_1.default, { name: "$" }), className, error, errorMessage, initialCount, itemProps, label, removeIcon, showInlineError, value } = _a, props = tslib_1.__rest(_a, ["addIcon", "children", "className", "error", "errorMessage", "initialCount", "itemProps", "label", "removeIcon", "showInlineError", "value"]); | ||
var { addIcon, children = react_1.default.createElement(ListItemField_1.default, { name: "$" }), className, error, errorMessage, itemProps, label, removeIcon, showInlineError, value } = _a, props = tslib_1.__rest(_a, ["addIcon", "children", "className", "error", "errorMessage", "itemProps", "label", "removeIcon", "showInlineError", "value"]); | ||
return (react_1.default.createElement("div", Object.assign({ className: classnames_1.default('card mb-3', className) }, uniforms_1.filterDOMProps(props)), | ||
@@ -18,3 +18,3 @@ react_1.default.createElement("div", { className: "card-body" }, | ||
"\u00A0"), | ||
react_1.default.createElement(ListAddField_1.default, { addIcon: addIcon, initialCount: initialCount, name: "$" }), | ||
react_1.default.createElement(ListAddField_1.default, { addIcon: addIcon, name: "$" }), | ||
!!(error && showInlineError) && (react_1.default.createElement("span", { className: "text-danger" }, errorMessage)))), value === null || value === void 0 ? void 0 : | ||
@@ -21,0 +21,0 @@ value.map((item, itemIndex) => react_1.Children.map(children, (child, childIndex) => { |
@@ -12,2 +12,5 @@ import invariant from 'invariant'; | ||
const AutoField = createAutoField(props => { | ||
if (props.component) { | ||
return props.component; | ||
} | ||
if (props.allowedValues) { | ||
@@ -14,0 +17,0 @@ return props.checkboxes && props.fieldType !== Array |
import { ComponentType } from 'react'; | ||
export declare type AutoFieldsProps = { | ||
autoField?: ComponentType<{ | ||
name: string; | ||
}>; | ||
element?: ComponentType | string; | ||
@@ -11,2 +8,2 @@ fields?: string[]; | ||
}; | ||
export default function AutoFields({ autoField, element, fields, omitFields, showInlineError, ...props }: AutoFieldsProps): import("react").ReactElement<{}, string | import("react").JSXElementConstructor<any>>; | ||
export default function AutoFields({ element, fields, omitFields, showInlineError, ...props }: AutoFieldsProps): import("react").ReactElement<{}, string | import("react").JSXElementConstructor<any>>; |
import { __rest } from "tslib"; | ||
import { createElement } from 'react'; | ||
import { Fragment, createElement } from 'react'; | ||
import { useForm } from 'uniforms'; | ||
import AutoField from './AutoField'; | ||
export default function AutoFields(_a) { | ||
var { autoField = AutoField, element = 'div', fields, omitFields = [], showInlineError } = _a, props = __rest(_a, ["autoField", "element", "fields", "omitFields", "showInlineError"]); | ||
var { element = Fragment, fields, omitFields = [], showInlineError } = _a, props = __rest(_a, ["element", "fields", "omitFields", "showInlineError"]); | ||
const { schema } = useForm(); | ||
return createElement(element, props, (fields !== null && fields !== void 0 ? fields : schema.getSubfields()) | ||
.filter(field => !omitFields.includes(field)) | ||
.map(field => createElement(autoField, Object.assign({ key: field, name: field }, showInlineError === undefined ? null : { showInlineError })))); | ||
.map(field => createElement(AutoField, Object.assign({ key: field, name: field }, showInlineError === undefined ? null : { showInlineError })))); | ||
} |
@@ -5,5 +5,4 @@ import { ReactNode } from 'react'; | ||
addIcon?: ReactNode; | ||
initialCount?: number; | ||
}>; | ||
declare const _default: import("uniforms").ConnectedField<ListAddFieldProps, unknown>; | ||
export default _default; |
@@ -7,6 +7,6 @@ import { __rest } from "tslib"; | ||
function ListAdd(_a) { | ||
var { addIcon, className, disabled, initialCount, name, readOnly, value } = _a, props = __rest(_a, ["addIcon", "className", "disabled", "initialCount", "name", "readOnly", "value"]); | ||
var { addIcon, className, disabled, name, readOnly, value } = _a, props = __rest(_a, ["addIcon", "className", "disabled", "name", "readOnly", "value"]); | ||
const nameParts = joinName(null, name); | ||
const parentName = joinName(nameParts.slice(0, -1)); | ||
const parent = useField(parentName, { initialCount }, { absoluteName: true })[0]; | ||
const parent = useField(parentName, {}, { absoluteName: true })[0]; | ||
const limitNotReached = !disabled && !(parent.maxCount <= parent.value.length); | ||
@@ -13,0 +13,0 @@ function onAction(event) { |
@@ -5,3 +5,2 @@ import { ReactNode } from 'react'; | ||
addIcon?: ReactNode; | ||
initialCount?: number; | ||
itemProps?: object; | ||
@@ -8,0 +7,0 @@ removeIcon?: ReactNode; |
@@ -8,3 +8,3 @@ import { __rest } from "tslib"; | ||
function List(_a) { | ||
var { addIcon, children = React.createElement(ListItemField, { name: "$" }), className, error, errorMessage, initialCount, itemProps, label, removeIcon, showInlineError, value } = _a, props = __rest(_a, ["addIcon", "children", "className", "error", "errorMessage", "initialCount", "itemProps", "label", "removeIcon", "showInlineError", "value"]); | ||
var { addIcon, children = React.createElement(ListItemField, { name: "$" }), className, error, errorMessage, itemProps, label, removeIcon, showInlineError, value } = _a, props = __rest(_a, ["addIcon", "children", "className", "error", "errorMessage", "itemProps", "label", "removeIcon", "showInlineError", "value"]); | ||
return (React.createElement("div", Object.assign({ className: classnames('card mb-3', className) }, filterDOMProps(props)), | ||
@@ -16,3 +16,3 @@ React.createElement("div", { className: "card-body" }, | ||
"\u00A0"), | ||
React.createElement(ListAddField, { addIcon: addIcon, initialCount: initialCount, name: "$" }), | ||
React.createElement(ListAddField, { addIcon: addIcon, name: "$" }), | ||
!!(error && showInlineError) && (React.createElement("span", { className: "text-danger" }, errorMessage)))), value === null || value === void 0 ? void 0 : | ||
@@ -19,0 +19,0 @@ value.map((item, itemIndex) => Children.map(children, (child, childIndex) => { |
{ | ||
"name": "uniforms-bootstrap4", | ||
"version": "3.10.1", | ||
"version": "4.0.0-alpha.0", | ||
"license": "MIT", | ||
@@ -38,6 +38,6 @@ "main": "./cjs/index.js", | ||
"tslib": "^2.2.0", | ||
"uniforms": "^3.10.1", | ||
"uniforms": "^4.0.0-alpha.0", | ||
"warning": "^4.0.0" | ||
}, | ||
"gitHead": "37fa8c1e482cb9c3e8bd6e6395258634366b5d8a" | ||
"gitHead": "94084d3c005b7338d27ed206b67a5a43abba357e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
175784
3819
2
+ Addedtslib@2.8.0(transitive)
+ Addeduniforms@4.0.0-beta.4(transitive)
- Removeduniforms@3.10.2(transitive)
Updateduniforms@^4.0.0-alpha.0