uniforms-bootstrap4
Advanced tools
Comparing version 3.0.0-alpha.1 to 3.0.0-alpha.2
@@ -1,7 +0,7 @@ | ||
/// <reference types="react" /> | ||
import { BaseField } from 'uniforms'; | ||
export default class AutoField extends BaseField { | ||
static displayName: string; | ||
getContextName(): any; | ||
render(): import("react").CElement<any, import("react").Component<any, any, any>>; | ||
} | ||
import { ComponentType } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type AutoFieldProps = Override<Record<string, unknown>, { | ||
component?: ComponentType<any>; | ||
name: string; | ||
}>; | ||
export default function AutoField(originalProps: AutoFieldProps): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>; |
import invariant from 'invariant'; | ||
import { BaseField } from 'uniforms'; | ||
import { createElement } from 'react'; | ||
import { useField } from 'uniforms'; | ||
import BoolField from './BoolField'; | ||
@@ -12,44 +12,40 @@ import DateField from './DateField'; | ||
import TextField from './TextField'; | ||
export default class AutoField extends BaseField { | ||
getContextName() { | ||
return this.context.uniforms.name; | ||
} | ||
render() { | ||
const props = this.getFieldProps(undefined, { ensureValue: false }); | ||
if (props.component === undefined) { | ||
if (props.allowedValues) { | ||
if (props.checkboxes && props.fieldType !== Array) { | ||
props.component = RadioField; | ||
} | ||
else { | ||
props.component = SelectField; | ||
} | ||
export default function AutoField(originalProps) { | ||
const props = useField(originalProps.name, originalProps)[0]; | ||
const { allowedValues, checkboxes, fieldType } = props; | ||
let { component } = props; | ||
if (component === undefined) { | ||
if (allowedValues) { | ||
if (checkboxes && fieldType !== Array) { | ||
component = RadioField; | ||
} | ||
else { | ||
switch (props.fieldType) { | ||
case Date: | ||
props.component = DateField; | ||
break; | ||
case Array: | ||
props.component = ListField; | ||
break; | ||
case Number: | ||
props.component = NumField; | ||
break; | ||
case Object: | ||
props.component = NestField; | ||
break; | ||
case String: | ||
props.component = TextField; | ||
break; | ||
case Boolean: | ||
props.component = BoolField; | ||
break; | ||
} | ||
invariant(props.component, 'Unsupported field type: %s', props.fieldType.toString()); | ||
component = SelectField; | ||
} | ||
} | ||
return createElement(props.component, this.props); | ||
else { | ||
switch (fieldType) { | ||
case Date: | ||
component = DateField; | ||
break; | ||
case Array: | ||
component = ListField; | ||
break; | ||
case Number: | ||
component = NumField; | ||
break; | ||
case Object: | ||
component = NestField; | ||
break; | ||
case String: | ||
component = TextField; | ||
break; | ||
case Boolean: | ||
component = BoolField; | ||
break; | ||
} | ||
invariant(component, 'Unsupported field type: %s', fieldType); | ||
} | ||
} | ||
return createElement(component, props); | ||
} | ||
AutoField.displayName = 'AutoField'; |
@@ -1,4 +0,12 @@ | ||
/// <reference types="react" /> | ||
import { ComponentType } from 'react'; | ||
import AutoField from './AutoField'; | ||
declare function AutoFields({ autoField, element, fields, omitFields, ...props }: any): import("react").DetailedReactHTMLElement<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; | ||
export declare type AutoFieldsProps = { | ||
autoField?: ComponentType<{ | ||
name: string; | ||
}>; | ||
element?: ComponentType | string; | ||
fields?: string[]; | ||
omitFields?: string[]; | ||
}; | ||
declare function AutoFields({ autoField, element, fields, omitFields, ...props }: AutoFieldsProps): import("react").ReactElement<{}, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>; | ||
declare namespace AutoFields { | ||
@@ -5,0 +13,0 @@ var defaultProps: { |
import { __rest } from "tslib"; | ||
import { context } from 'uniforms'; | ||
import { createElement, useContext } from 'react'; | ||
import { createElement } from 'react'; | ||
import { useForm } from 'uniforms'; | ||
import AutoField from './AutoField'; | ||
function AutoFields(_a) { | ||
export default function AutoFields(_a) { | ||
var { autoField, element, fields, omitFields } = _a, props = __rest(_a, ["autoField", "element", "fields", "omitFields"]); | ||
const { schema } = useContext(context).uniforms; | ||
return createElement(element, props, (fields || schema.getSubfields()) | ||
.filter((field) => omitFields.indexOf(field) === -1) | ||
.map((field) => createElement(autoField, { key: field, name: field }))); | ||
const { schema } = useForm(); | ||
return createElement(element, props, (fields !== null && fields !== void 0 ? fields : schema.getSubfields()) | ||
.filter(field => !omitFields.includes(field)) | ||
.map(field => createElement(autoField, { key: field, name: field }))); | ||
} | ||
@@ -17,2 +17,1 @@ AutoFields.defaultProps = { | ||
}; | ||
export default AutoFields; |
import { AutoForm } from 'uniforms'; | ||
import ValidatedQuickForm from './ValidatedQuickForm'; | ||
const Auto = (parent) => { var _a; return _a = class extends AutoForm.Auto(parent) { | ||
}, | ||
_a.Auto = Auto, | ||
_a; }; | ||
function Auto(parent) { | ||
class _ extends AutoForm.Auto(parent) { | ||
} | ||
_.Auto = Auto; | ||
return _; | ||
} | ||
export default Auto(ValidatedQuickForm); |
import { __rest } from "tslib"; | ||
import classnames from 'classnames'; | ||
import { BaseForm } from 'uniforms'; | ||
const Bootstrap4 = (parent) => { var _a; return _a = class extends parent { | ||
function Bootstrap4(parent) { | ||
class _ extends parent { | ||
getContextState() { | ||
@@ -14,6 +15,7 @@ return Object.assign(Object.assign({}, super.getContextState()), { grid: this.props.grid }); | ||
} | ||
}, | ||
_a.Bootstrap4 = Bootstrap4, | ||
_a.displayName = `Bootstrap4${parent.displayName}`, | ||
_a; }; | ||
} | ||
_.Bootstrap4 = Bootstrap4; | ||
_.displayName = `Bootstrap4${parent.displayName}`; | ||
return _; | ||
} | ||
export default Bootstrap4(BaseForm); |
@@ -1,2 +0,25 @@ | ||
declare const _default: any; | ||
import React, { HTMLProps, Ref } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type BoolFieldProps = Override<HTMLProps<HTMLDivElement>, { | ||
disabled?: boolean; | ||
error?: boolean; | ||
inline?: boolean; | ||
inputClassName?: string; | ||
inputRef?: Ref<HTMLInputElement>; | ||
labelBefore: string; | ||
onChange(value?: boolean): void; | ||
value?: boolean; | ||
}>; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<boolean | undefined>> & Pick<Override<React.HTMLProps<HTMLDivElement>, { | ||
disabled?: boolean | undefined; | ||
error?: boolean | undefined; | ||
inline?: boolean | undefined; | ||
inputClassName?: string | undefined; | ||
inputRef?: ((instance: HTMLInputElement | null) => void) | React.RefObject<HTMLInputElement> | null | undefined; | ||
labelBefore: string; | ||
onChange(value?: boolean | undefined): void; | ||
value?: boolean | undefined; | ||
}>, "start" | "hidden" | "color" | "content" | "size" | "style" | "default" | "inline" | "wrap" | "open" | "multiple" | "cite" | "data" | "form" | "slot" | "span" | "summary" | "title" | "pattern" | "key" | "ref" | "children" | "list" | "step" | "async" | "noValidate" | "onSubmit" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "inputClassName" | "inputRef" | "labelBefore">>; | ||
export default _default; |
import { __rest } from "tslib"; | ||
import classnames from 'classnames'; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { connectField } from 'uniforms'; | ||
import wrapField from './wrapField'; | ||
const Bool = (_a) => { | ||
var { label, labelBefore } = _a, props = __rest(_a, ["label", "labelBefore"]); | ||
return wrapField(Object.assign({ label: labelBefore }, props), React.createElement("div", { className: classnames(props.inputClassName, 'form-check', 'checkbox', { | ||
'text-danger': props.error, | ||
'custom-control-inline': props.inline, | ||
function Bool(_a) { | ||
var { onChange } = _a, props = __rest(_a, ["onChange"]); | ||
const { disabled, error, inline, inputClassName, inputRef, label, labelBefore, name, value, } = props; | ||
return wrapField(Object.assign(Object.assign({}, props), { label: labelBefore, value: props.value }), React.createElement("div", { className: classnames(inputClassName, 'form-check', 'checkbox', { | ||
'text-danger': error, | ||
'custom-control-inline': inline, | ||
}) }, | ||
React.createElement("label", { htmlFor: props.id, className: "form-check-label" }, | ||
React.createElement("input", { checked: props.value, className: "form-check-input", disabled: props.disabled, id: props.id, name: props.name, onChange: () => props.onChange(!props.value), ref: props.inputRef, type: "checkbox" }), | ||
React.createElement("input", { checked: value || false, className: "form-check-input", disabled: disabled, id: props.id, name: name, onChange: () => onChange(!value), ref: inputRef, type: "checkbox" }), | ||
"\u00A0", | ||
label))); | ||
}; | ||
} | ||
export default connectField(Bool); |
@@ -1,2 +0,35 @@ | ||
declare const _default: any; | ||
import React, { HTMLProps, Ref } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type DateFieldProps = Override<HTMLProps<HTMLDivElement>, { | ||
disabled: boolean; | ||
error: unknown; | ||
id: string; | ||
inputClassName: string; | ||
inputRef?: Ref<HTMLInputElement>; | ||
max?: Date; | ||
min?: Date; | ||
name: string; | ||
onChange(value?: Date): void; | ||
placeholder: string; | ||
showInlineError: boolean; | ||
value?: Date; | ||
wrapClassName?: string; | ||
}>; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<Date | undefined>> & Pick<Override<React.HTMLProps<HTMLDivElement>, { | ||
disabled: boolean; | ||
error: unknown; | ||
id: string; | ||
inputClassName: string; | ||
inputRef?: ((instance: HTMLInputElement | null) => void) | React.RefObject<HTMLInputElement> | null | undefined; | ||
max?: Date | undefined; | ||
min?: Date | undefined; | ||
name: string; | ||
onChange(value?: Date | undefined): void; | ||
placeholder: string; | ||
showInlineError: boolean; | ||
value?: Date | undefined; | ||
wrapClassName?: string | undefined; | ||
}>, "start" | "hidden" | "color" | "content" | "size" | "style" | "default" | "wrap" | "open" | "multiple" | "cite" | "data" | "form" | "slot" | "span" | "summary" | "title" | "pattern" | "key" | "ref" | "children" | "list" | "step" | "async" | "noValidate" | "onSubmit" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "wrapClassName" | "inputClassName" | "inputRef">>; | ||
export default _default; |
@@ -0,1 +1,2 @@ | ||
import { __rest } from "tslib"; | ||
import React from 'react'; | ||
@@ -6,15 +7,18 @@ import classnames from 'classnames'; | ||
const DateConstructor = (typeof global === 'object' ? global : window).Date; | ||
const dateFormat = value => value && value.toISOString().slice(0, -8); | ||
const dateParse = (timestamp, onChange) => { | ||
const date = new DateConstructor(timestamp); | ||
if (date.getFullYear() < 10000) { | ||
onChange(date); | ||
} | ||
else if (isNaN(timestamp)) { | ||
onChange(undefined); | ||
} | ||
}; | ||
const Date = props => wrapField(props, React.createElement("input", { className: classnames(props.inputClassName, 'form-control', { | ||
'is-invalid': props.error, | ||
}), disabled: props.disabled, id: props.id, max: dateFormat(props.max), min: dateFormat(props.min), name: props.name, onChange: event => dateParse(event.target.valueAsNumber, props.onChange), placeholder: props.placeholder, ref: props.inputRef, type: "datetime-local", value: dateFormat(props.value) })); | ||
const dateFormat = (value) => value === null || value === void 0 ? void 0 : value.toISOString().slice(0, -8); | ||
function Date(_a) { | ||
var _b; | ||
var { disabled, error, id, inputClassName, inputRef, max, min, name, onChange, placeholder, showInlineError, value, wrapClassName } = _a, props = __rest(_a, ["disabled", "error", "id", "inputClassName", "inputRef", "max", "min", "name", "onChange", "placeholder", "showInlineError", "value", "wrapClassName"]); | ||
return wrapField(Object.assign(Object.assign({}, props), { id }), React.createElement("input", { className: classnames(inputClassName, 'form-control', { | ||
'is-invalid': error, | ||
}), disabled: disabled, id: id, max: dateFormat(max), min: dateFormat(min), name: name, onChange: event => { | ||
const date = new DateConstructor(event.target.valueAsNumber); | ||
if (date.getFullYear() < 10000) { | ||
onChange(date); | ||
} | ||
else if (isNaN(event.target.valueAsNumber)) { | ||
onChange(undefined); | ||
} | ||
}, placeholder: placeholder, ref: inputRef, type: "datetime-local", value: (_b = dateFormat(value)) !== null && _b !== void 0 ? _b : '' })); | ||
} | ||
export default connectField(Date); |
@@ -1,2 +0,13 @@ | ||
declare const _default: any; | ||
import React, { HTMLProps } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type ErrorFieldProps = Override<HTMLProps<HTMLDivElement>, { | ||
error?: any; | ||
errorMessage?: string; | ||
}>; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<string | number | string[] | undefined>> & Pick<Override<React.HTMLProps<HTMLDivElement>, { | ||
error?: any; | ||
errorMessage?: string | undefined; | ||
}>, "start" | "hidden" | "color" | "content" | "size" | "style" | "default" | "wrap" | "open" | "multiple" | "cite" | "data" | "form" | "slot" | "span" | "summary" | "title" | "pattern" | "key" | "ref" | "children" | "list" | "step" | "async" | "noValidate" | "onSubmit" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture">>; | ||
export default _default; |
import { __rest } from "tslib"; | ||
import classnames from 'classnames'; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { connectField, filterDOMProps } from 'uniforms'; | ||
const Error = (_a) => { | ||
function Error(_a) { | ||
var { children, className, error, errorMessage } = _a, props = __rest(_a, ["children", "className", "error", "errorMessage"]); | ||
return !error ? null : (React.createElement("div", Object.assign({ className: classnames('card', 'mb-3', className) }, filterDOMProps(props)), | ||
React.createElement("div", { className: "card-body" }, children ? children : React.createElement("h4", { className: "card-title" }, errorMessage)))); | ||
}; | ||
} | ||
export default connectField(Error, { initialValue: false }); |
@@ -1,3 +0,7 @@ | ||
/// <reference types="react" /> | ||
declare const ErrorsField: ({ className, children, ...props }: any) => JSX.Element | null; | ||
import { HTMLProps } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type ErrorsFieldProps = Override<HTMLProps<HTMLDivElement>, { | ||
name: string; | ||
}>; | ||
declare function ErrorsField({ children, className, name, ...props }: ErrorsFieldProps): JSX.Element | null; | ||
export default ErrorsField; |
import { __rest } from "tslib"; | ||
import React, { useContext } from 'react'; | ||
import classnames from 'classnames'; | ||
import { context, filterDOMProps } from 'uniforms'; | ||
const ErrorsField = (_a) => { | ||
var { className, children } = _a, props = __rest(_a, ["className", "children"]); | ||
const { error, schema } = useContext(context).uniforms; | ||
import React from 'react'; | ||
import { filterDOMProps, useForm } from 'uniforms'; | ||
function ErrorsField(_a) { | ||
var { children, className, name } = _a, props = __rest(_a, ["children", "className", "name"]); | ||
const { error, schema } = useForm(); | ||
return !error && !children ? null : (React.createElement("div", Object.assign({ className: classnames('card border-danger mb-3 text-danger', className) }, filterDOMProps(props)), | ||
@@ -12,3 +12,3 @@ React.createElement("div", { className: "card-body" }, | ||
schema.getErrorMessages(error).map((message, index) => (React.createElement("div", { key: index, className: "disabled" }, message)))))); | ||
}; | ||
} | ||
export default ErrorsField; |
/// <reference types="react" /> | ||
declare const FormGroup: ({ children, ...props }: any) => JSX.Element; | ||
declare function FormGroup({ children, ...props }: any): JSX.Element; | ||
export default FormGroup; |
import { __rest } from "tslib"; | ||
import warning from 'warning'; | ||
import wrapField from './wrapField'; | ||
const FormGroup = (_a) => { | ||
function FormGroup(_a) { | ||
var { children } = _a, props = __rest(_a, ["children"]); | ||
warning(false, 'FormGroup is deprecated and will be removed in the next release.'); | ||
return wrapField(props, children); | ||
}; | ||
} | ||
export default FormGroup; |
@@ -1,8 +0,9 @@ | ||
/// <reference types="react" /> | ||
import { BaseField } from 'uniforms'; | ||
export default class HiddenField extends BaseField { | ||
static displayName: string; | ||
constructor(); | ||
componentDidUpdate(): void; | ||
render(): JSX.Element | null; | ||
} | ||
import { HTMLProps, Ref } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type HiddenFieldProps = Override<HTMLProps<HTMLInputElement>, { | ||
inputRef?: Ref<HTMLInputElement>; | ||
name: string; | ||
noDOM?: boolean; | ||
value?: any; | ||
}>; | ||
export default function HiddenField({ value, ...rawProps }: HiddenFieldProps): JSX.Element | null; |
@@ -1,26 +0,13 @@ | ||
import React from 'react'; | ||
import { BaseField, filterDOMProps } from 'uniforms'; | ||
export default class HiddenField extends BaseField { | ||
constructor() { | ||
// @ts-ignore | ||
super(...arguments); | ||
this.options = { | ||
ensureValue: true, | ||
overrideValue: true, | ||
}; | ||
} | ||
componentDidUpdate() { | ||
const { value } = this.props; | ||
if (value !== undefined) { | ||
const props = this.getFieldProps(); | ||
if (props.value !== value) { | ||
props.onChange(value); | ||
} | ||
} | ||
} | ||
render() { | ||
const props = this.getFieldProps(); | ||
return props.noDOM ? null : (React.createElement("input", Object.assign({ disabled: props.disabled, id: props.id, name: props.name, ref: props.inputRef, type: "hidden", value: props.value }, filterDOMProps(props)))); | ||
} | ||
import { __rest } from "tslib"; | ||
import React, { useEffect } from 'react'; | ||
import { filterDOMProps, useField } from 'uniforms'; | ||
export default function HiddenField(_a) { | ||
var _b; | ||
var { value } = _a, rawProps = __rest(_a, ["value"]); | ||
const props = useField(rawProps.name, rawProps, { initialValue: false })[0]; | ||
useEffect(() => { | ||
if (value !== undefined && value !== props.value) | ||
props.onChange(value); | ||
}); | ||
return props.noDOM ? null : (React.createElement("input", Object.assign({ disabled: props.disabled, id: props.id, name: props.name, ref: props.inputRef, type: "hidden", value: (_b = value !== null && value !== void 0 ? value : props.value) !== null && _b !== void 0 ? _b : '' }, filterDOMProps(props)))); | ||
} | ||
HiddenField.displayName = 'HiddenField'; |
@@ -1,26 +0,25 @@ | ||
export { default as AutoFields } from './AutoFields'; | ||
export { default as AutoField } from './AutoField'; | ||
export { default as AutoField, AutoFieldProps } from './AutoField'; | ||
export { default as AutoFields, AutoFieldsProps } from './AutoFields'; | ||
export { default as AutoForm } from './AutoForm'; | ||
export { default as BaseForm } from './BaseForm'; | ||
export { default as BoolField } from './BoolField'; | ||
export { default as DateField } from './DateField'; | ||
export { default as ErrorField } from './ErrorField'; | ||
export { default as ErrorsField } from './ErrorsField'; | ||
export { default as FormGroup } from './FormGroup'; | ||
export { default as HiddenField } from './HiddenField'; | ||
export { default as ListAddField } from './ListAddField'; | ||
export { default as ListDelField } from './ListDelField'; | ||
export { default as ListField } from './ListField'; | ||
export { default as ListItemField } from './ListItemField'; | ||
export { default as LongTextField } from './LongTextField'; | ||
export { default as NestField } from './NestField'; | ||
export { default as NumField } from './NumField'; | ||
export { default as BoolField, BoolFieldProps } from './BoolField'; | ||
export { default as DateField, DateFieldProps } from './DateField'; | ||
export { default as ErrorField, ErrorFieldProps } from './ErrorField'; | ||
export { default as ErrorsField, ErrorsFieldProps } from './ErrorsField'; | ||
export { default as gridClassName } from './gridClassName'; | ||
export { default as HiddenField, HiddenFieldProps } from './HiddenField'; | ||
export { default as ListAddField, ListAddFieldProps } from './ListAddField'; | ||
export { default as ListDelField, ListDelFieldProps } from './ListDelField'; | ||
export { default as ListField, ListFieldProps } from './ListField'; | ||
export { default as ListItemField, ListItemFieldProps } from './ListItemField'; | ||
export { default as LongTextField, LongTextFieldProps } from './LongTextField'; | ||
export { default as NestField, NestFieldProps } from './NestField'; | ||
export { default as NumField, NumFieldProps } from './NumField'; | ||
export { default as QuickForm } from './QuickForm'; | ||
export { default as RadioField } from './RadioField'; | ||
export { default as SelectField } from './SelectField'; | ||
export { default as SubmitField } from './SubmitField'; | ||
export { default as TextField } from './TextField'; | ||
export { default as RadioField, RadioFieldProps } from './RadioField'; | ||
export { default as SelectField, SelectFieldProps } from './SelectField'; | ||
export { default as SubmitField, SubmitFieldProps } from './SubmitField'; | ||
export { default as TextField, TextFieldProps } from './TextField'; | ||
export { default as ValidatedForm } from './ValidatedForm'; | ||
export { default as ValidatedQuickForm } from './ValidatedQuickForm'; | ||
export { default as gridClassName } from './gridClassName'; | ||
export { default as wrapField } from './wrapField'; |
@@ -0,3 +1,3 @@ | ||
export { default as AutoField } from './AutoField'; | ||
export { default as AutoFields } from './AutoFields'; | ||
export { default as AutoField } from './AutoField'; | ||
export { default as AutoForm } from './AutoForm'; | ||
@@ -9,3 +9,3 @@ export { default as BaseForm } from './BaseForm'; | ||
export { default as ErrorsField } from './ErrorsField'; | ||
export { default as FormGroup } from './FormGroup'; | ||
export { default as gridClassName } from './gridClassName'; | ||
export { default as HiddenField } from './HiddenField'; | ||
@@ -26,3 +26,2 @@ export { default as ListAddField } from './ListAddField'; | ||
export { default as ValidatedQuickForm } from './ValidatedQuickForm'; | ||
export { default as gridClassName } from './gridClassName'; | ||
export { default as wrapField } from './wrapField'; |
@@ -1,2 +0,15 @@ | ||
declare const _default: any; | ||
export default _default; | ||
import { HTMLProps } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type ListAddFieldProps<T> = Override<HTMLProps<HTMLDivElement>, { | ||
addIcon?: any; | ||
name: string; | ||
parent?: any; | ||
value?: T; | ||
}>; | ||
declare function ListAdd<T>({ addIcon, ...rawProps }: ListAddFieldProps<T>): JSX.Element; | ||
declare namespace ListAdd { | ||
var defaultProps: { | ||
addIcon: JSX.Element; | ||
}; | ||
} | ||
export default ListAdd; |
import { __rest } from "tslib"; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import cloneDeep from 'lodash/cloneDeep'; | ||
import { connectField, filterDOMProps } from 'uniforms'; | ||
const ListAdd = (_a) => { | ||
var { addIcon, className, disabled, parent, value } = _a, props = __rest(_a, ["addIcon", "className", "disabled", "parent", "value"]); | ||
const limitNotReached = !disabled && !(parent.maxCount <= parent.value.length); | ||
return (React.createElement("div", Object.assign({ className: classnames('badge badge-pill float-right', className), onClick: () => limitNotReached && | ||
parent.onChange(parent.value.concat([cloneDeep(value)])) }, filterDOMProps(props)), addIcon)); | ||
}; | ||
import React from 'react'; | ||
import { filterDOMProps, joinName, useField } from 'uniforms'; | ||
function ListAdd(_a) { | ||
var { addIcon } = _a, rawProps = __rest(_a, ["addIcon"]); | ||
const props = useField(rawProps.name, rawProps, { | ||
initialValue: false, | ||
})[0]; | ||
const parentName = joinName(joinName(null, props.name).slice(0, -1)); | ||
const parent = useField(parentName, {})[0]; | ||
if (rawProps.parent) | ||
Object.assign(parent, rawProps.parent); | ||
const limitNotReached = !props.disabled && !(parent.maxCount <= parent.value.length); | ||
return (React.createElement("div", Object.assign({ className: classnames('badge badge-pill float-right', rawProps.className), onClick: () => { | ||
if (limitNotReached) | ||
parent.onChange(parent.value.concat([cloneDeep(props.value)])); | ||
} }, filterDOMProps(props)), addIcon)); | ||
} | ||
ListAdd.defaultProps = { addIcon: React.createElement("i", { className: "octicon octicon-plus" }) }; | ||
export default connectField(ListAdd, { | ||
includeParent: true, | ||
initialValue: false, | ||
}); | ||
export default ListAdd; |
@@ -1,2 +0,15 @@ | ||
declare const _default: any; | ||
export default _default; | ||
import { HTMLProps } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type ListDelFieldProps<T> = Override<HTMLProps<HTMLSpanElement>, { | ||
name: string; | ||
parent?: any; | ||
removeIcon?: any; | ||
value?: T; | ||
}>; | ||
declare function ListDel<T>({ removeIcon, ...rawProps }: ListDelFieldProps<T>): JSX.Element; | ||
declare namespace ListDel { | ||
var defaultProps: { | ||
removeIcon: JSX.Element; | ||
}; | ||
} | ||
export default ListDel; |
import { __rest } from "tslib"; | ||
import classnames from 'classnames'; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { connectField, filterDOMProps } from 'uniforms'; | ||
const ListDel = (_a) => { | ||
var { className, disabled, name, parent, removeIcon } = _a, props = __rest(_a, ["className", "disabled", "name", "parent", "removeIcon"]); | ||
const fieldIndex = +name.slice(1 + name.lastIndexOf('.')); | ||
const limitNotReached = !disabled && !(parent.minCount >= parent.value.length); | ||
return (React.createElement("span", Object.assign({ className: classnames('badge badge-pill', className), onClick: () => limitNotReached && | ||
parent.onChange([] | ||
.concat(parent.value.slice(0, fieldIndex)) | ||
.concat(parent.value.slice(1 + fieldIndex))) }, filterDOMProps(props)), removeIcon)); | ||
}; | ||
import { filterDOMProps, joinName, useField } from 'uniforms'; | ||
function ListDel(_a) { | ||
var { removeIcon } = _a, rawProps = __rest(_a, ["removeIcon"]); | ||
const props = useField(rawProps.name, rawProps, { | ||
initialValue: false, | ||
})[0]; | ||
const nameParts = joinName(null, props.name); | ||
const parentName = joinName(nameParts.slice(0, -1)); | ||
const parent = useField(parentName, {})[0]; | ||
if (rawProps.parent) | ||
Object.assign(parent, rawProps.parent); | ||
const fieldIndex = +nameParts[nameParts.length - 1]; | ||
const limitNotReached = !props.disabled && !(parent.minCount >= parent.value.length); | ||
return (React.createElement("span", Object.assign({ className: classnames('badge badge-pill', rawProps.className), onClick: () => { | ||
if (limitNotReached) { | ||
const value = parent.value.slice(); | ||
value.splice(fieldIndex, 1); | ||
parent.onChange(value); | ||
} | ||
} }, filterDOMProps(props)), removeIcon)); | ||
} | ||
ListDel.defaultProps = { removeIcon: React.createElement("i", { className: "octicon octicon-dash" }) }; | ||
export default connectField(ListDel, { | ||
includeParent: true, | ||
initialValue: false, | ||
}); | ||
export default ListDel; |
@@ -1,2 +0,29 @@ | ||
declare const _default: any; | ||
import React, { HTMLProps, ReactNode } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type ListFieldProps<T> = Override<HTMLProps<HTMLDivElement>, { | ||
addIcon?: any; | ||
children?: ReactNode; | ||
error?: boolean; | ||
errorMessage?: string; | ||
initialCount?: number; | ||
itemProps?: {}; | ||
name: string; | ||
removeIcon?: any; | ||
showInlineError?: boolean; | ||
value: T[]; | ||
}>; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<unknown[]>> & Pick<Override<React.HTMLProps<HTMLDivElement>, { | ||
addIcon?: any; | ||
children?: React.ReactNode; | ||
error?: boolean | undefined; | ||
errorMessage?: string | undefined; | ||
initialCount?: number | undefined; | ||
itemProps?: {} | undefined; | ||
name: string; | ||
removeIcon?: any; | ||
showInlineError?: boolean | undefined; | ||
value: unknown[]; | ||
}>, "start" | "hidden" | "color" | "content" | "size" | "style" | "default" | "wrap" | "open" | "multiple" | "cite" | "data" | "form" | "slot" | "span" | "summary" | "title" | "pattern" | "key" | "ref" | "children" | "list" | "step" | "async" | "noValidate" | "onSubmit" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "removeIcon" | "addIcon" | "initialCount" | "itemProps">>; | ||
export default _default; |
import { __rest } from "tslib"; | ||
import React, { Children } from 'react'; | ||
import React, { Children, cloneElement } from 'react'; | ||
import classnames from 'classnames'; | ||
@@ -7,4 +7,9 @@ import { connectField, filterDOMProps, joinName } from 'uniforms'; | ||
import ListAddField from './ListAddField'; | ||
const List = (_a) => { | ||
function List(_a) { | ||
var { addIcon, children, className, error, errorMessage, initialCount, itemProps, label, name, removeIcon, showInlineError, value } = _a, props = __rest(_a, ["addIcon", "children", "className", "error", "errorMessage", "initialCount", "itemProps", "label", "name", "removeIcon", "showInlineError", "value"]); | ||
const listAddProps = { | ||
name: `${name}.$`, | ||
initialCount, | ||
addIcon, | ||
}; | ||
return (React.createElement("div", Object.assign({ className: classnames('card mb-3', className) }, filterDOMProps(props)), | ||
@@ -16,6 +21,6 @@ React.createElement("div", { className: "card-body" }, | ||
"\u00A0"), | ||
React.createElement(ListAddField, { name: `${name}.$`, initialCount: initialCount, addIcon: addIcon }), | ||
React.createElement(ListAddField, Object.assign({}, listAddProps)), | ||
!!(error && showInlineError) && (React.createElement("span", { className: "text-danger" }, errorMessage)))), | ||
children | ||
? value.map((item, index) => Children.map(children, child => React.cloneElement(child, { | ||
? value.map((item, index) => Children.map(children, child => cloneElement(child, { | ||
key: index, | ||
@@ -26,7 +31,6 @@ label: null, | ||
}))) | ||
: value.map((item, index) => (React.createElement(ListItemField, Object.assign({ key: index, label: null, name: joinName(name, index), removeIcon: removeIcon }, itemProps))))))); | ||
}; | ||
: value.map((item, index) => (React.createElement(ListItemField, Object.assign({ key: index, label: undefined, name: joinName(name, index), removeIcon: removeIcon }, itemProps))))))); | ||
} | ||
export default connectField(List, { | ||
ensureValue: false, | ||
includeInChain: false, | ||
}); |
@@ -1,2 +0,10 @@ | ||
declare const _default: any; | ||
import React, { ReactNode } from 'react'; | ||
export declare type ListItemFieldProps = { | ||
children?: ReactNode; | ||
name: string; | ||
removeIcon?: any; | ||
}; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<unknown>> & Pick<ListItemFieldProps, "children" | "removeIcon">>; | ||
export default _default; |
import { __rest } from "tslib"; | ||
import React, { Children } from 'react'; | ||
import React, { Children, cloneElement } from 'react'; | ||
import { connectField, joinName } from 'uniforms'; | ||
import AutoField from './AutoField'; | ||
import ListDelField from './ListDelField'; | ||
const ListItem = (_a) => { | ||
function ListItem(_a) { | ||
var { removeIcon } = _a, props = __rest(_a, ["removeIcon"]); | ||
const { name, children } = props; | ||
return (React.createElement("div", { className: "row" }, | ||
React.createElement("div", { className: "col-1" }, | ||
React.createElement(ListDelField, { name: props.name, removeIcon: removeIcon })), | ||
props.children ? (Children.map(props.children, child => React.cloneElement(child, { | ||
React.createElement(ListDelField, { name: name, removeIcon: removeIcon })), | ||
children ? (Children.map(children, child => cloneElement(child, { | ||
className: 'col-11', | ||
name: joinName(props.name, child.props.name), | ||
name: joinName(name, child.props.name), | ||
label: null, | ||
}))) : (React.createElement(AutoField, Object.assign({}, props, { className: "col-11" }))))); | ||
}; | ||
export default connectField(ListItem, { | ||
includeInChain: false, | ||
includeParent: true, | ||
}); | ||
} | ||
export default connectField(ListItem, { includeInChain: false }); |
@@ -1,2 +0,19 @@ | ||
declare const _default: any; | ||
import React, { HTMLProps, Ref } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type LongTextFieldProps = Override<HTMLProps<HTMLDivElement>, { | ||
error?: boolean; | ||
inputClassName?: string; | ||
inputRef?: Ref<HTMLTextAreaElement>; | ||
onChange(value?: string): void; | ||
value?: string; | ||
}>; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<string | undefined>> & Pick<Override<React.HTMLProps<HTMLDivElement>, { | ||
error?: boolean | undefined; | ||
inputClassName?: string | undefined; | ||
inputRef?: ((instance: HTMLTextAreaElement | null) => void) | React.RefObject<HTMLTextAreaElement> | null | undefined; | ||
onChange(value?: string | undefined): void; | ||
value?: string | undefined; | ||
}>, "start" | "hidden" | "color" | "content" | "size" | "style" | "default" | "wrap" | "open" | "multiple" | "cite" | "data" | "form" | "slot" | "span" | "summary" | "title" | "pattern" | "key" | "ref" | "children" | "list" | "step" | "async" | "noValidate" | "onSubmit" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "inputClassName" | "inputRef">>; | ||
export default _default; |
@@ -0,8 +1,12 @@ | ||
import classnames from 'classnames'; | ||
import omit from 'lodash/omit'; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { connectField } from 'uniforms'; | ||
import wrapField from './wrapField'; | ||
const LongText = props => wrapField(props, React.createElement("textarea", { className: classnames(props.inputClassName, 'form-control', { | ||
'is-invalid': props.error, | ||
}), disabled: props.disabled, id: props.id, name: props.name, onChange: event => props.onChange(event.target.value), placeholder: props.placeholder, ref: props.inputRef, rows: props.rows, value: props.value })); | ||
function LongText(props) { | ||
var _a; | ||
return wrapField(omit(props, ['value', 'onChange']), React.createElement("textarea", { className: classnames(props.inputClassName, 'form-control', { | ||
'is-invalid': props.error, | ||
}), disabled: props.disabled, id: props.id, name: props.name, onChange: event => props.onChange(event.target.value), placeholder: props.placeholder, ref: props.inputRef, rows: props.rows, value: (_a = props.value) !== null && _a !== void 0 ? _a : '' })); | ||
} | ||
export default connectField(LongText); |
@@ -1,2 +0,21 @@ | ||
declare const _default: any; | ||
import React, { HTMLProps } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type NestFieldProps = Override<HTMLProps<HTMLDivElement>, { | ||
error?: boolean; | ||
errorMessage?: string; | ||
fields?: any[]; | ||
itemProps?: object; | ||
name: string; | ||
showInlineError?: boolean; | ||
}>; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<string | number | string[] | undefined>> & Pick<Override<React.HTMLProps<HTMLDivElement>, { | ||
error?: boolean | undefined; | ||
errorMessage?: string | undefined; | ||
fields?: any[] | undefined; | ||
itemProps?: object | undefined; | ||
name: string; | ||
showInlineError?: boolean | undefined; | ||
}>, "start" | "hidden" | "color" | "content" | "size" | "style" | "default" | "wrap" | "open" | "multiple" | "cite" | "data" | "form" | "slot" | "span" | "summary" | "title" | "pattern" | "key" | "ref" | "children" | "list" | "step" | "async" | "noValidate" | "onSubmit" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "itemProps">>; | ||
export default _default; |
import { __rest } from "tslib"; | ||
import classnames from 'classnames'; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { connectField, filterDOMProps, injectName, joinName } from 'uniforms'; | ||
import { connectField, filterDOMProps, injectName, joinName, } from 'uniforms'; | ||
import AutoField from './AutoField'; | ||
const Nest = (_a) => { | ||
function Nest(_a) { | ||
var { children, className, error, errorMessage, fields, itemProps, label, name, showInlineError } = _a, props = __rest(_a, ["children", "className", "error", "errorMessage", "fields", "itemProps", "label", "name", "showInlineError"]); | ||
@@ -13,7 +13,4 @@ return (React.createElement("div", Object.assign({ className: classnames(className, { 'has-error': error }) }, filterDOMProps(props)), | ||
? injectName(name, children) | ||
: fields.map(key => (React.createElement(AutoField, Object.assign({ key: key, name: joinName(name, key) }, itemProps)))))); | ||
}; | ||
export default connectField(Nest, { | ||
ensureValue: false, | ||
includeInChain: false, | ||
}); | ||
: fields === null || fields === void 0 ? void 0 : fields.map(key => (React.createElement(AutoField, Object.assign({ key: key, name: joinName(name, key) }, itemProps)))))); | ||
} | ||
export default connectField(Nest, { includeInChain: false }); |
@@ -1,2 +0,21 @@ | ||
declare const _default: any; | ||
import React, { HTMLProps, Ref } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type NumFieldProps = Override<HTMLProps<HTMLDivElement>, { | ||
decimal?: boolean; | ||
error?: boolean; | ||
inputClassName?: string; | ||
inputRef?: Ref<HTMLInputElement>; | ||
onChange: (value?: number) => void; | ||
value?: number; | ||
}>; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<number | undefined>> & Pick<Override<React.HTMLProps<HTMLDivElement>, { | ||
decimal?: boolean | undefined; | ||
error?: boolean | undefined; | ||
inputClassName?: string | undefined; | ||
inputRef?: ((instance: HTMLInputElement | null) => void) | React.RefObject<HTMLInputElement> | null | undefined; | ||
onChange: (value?: number | undefined) => void; | ||
value?: number | undefined; | ||
}>, "start" | "hidden" | "color" | "content" | "size" | "style" | "default" | "wrap" | "open" | "multiple" | "cite" | "data" | "form" | "slot" | "span" | "summary" | "title" | "pattern" | "key" | "ref" | "children" | "decimal" | "list" | "step" | "async" | "noValidate" | "onSubmit" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "inputClassName" | "inputRef">>; | ||
export default _default; |
@@ -0,12 +1,16 @@ | ||
import classnames from 'classnames'; | ||
import omit from 'lodash/omit'; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { connectField } from 'uniforms'; | ||
import wrapField from './wrapField'; | ||
const Num = props => wrapField(props, React.createElement("input", { className: classnames(props.inputClassName, 'form-control', { | ||
'is-invalid': props.error, | ||
}), disabled: props.disabled, id: props.id, max: props.max, min: props.min, name: props.name, onChange: event => { | ||
const parse = props.decimal ? parseFloat : parseInt; | ||
const value = parse(event.target.value); | ||
props.onChange(isNaN(value) ? undefined : value); | ||
}, placeholder: props.placeholder, ref: props.inputRef, step: props.step || (props.decimal ? 0.01 : 1), type: "number", value: props.value })); | ||
function Num(props) { | ||
var _a; | ||
return wrapField(omit(props, ['value', 'onChange']), React.createElement("input", { className: classnames(props.inputClassName, 'form-control', { | ||
'is-invalid': props.error, | ||
}), disabled: props.disabled, id: props.id, max: props.max, min: props.min, name: props.name, onChange: event => { | ||
const parse = props.decimal ? parseFloat : parseInt; | ||
const value = parse(event.target.value); | ||
props.onChange(isNaN(value) ? undefined : value); | ||
}, placeholder: props.placeholder, ref: props.inputRef, step: props.step || (props.decimal ? 0.01 : 1), type: "number", value: (_a = props.value) !== null && _a !== void 0 ? _a : '' })); | ||
} | ||
export default connectField(Num); |
@@ -6,3 +6,4 @@ import { QuickForm } from 'uniforms'; | ||
import SubmitField from './SubmitField'; | ||
const Quick = (parent) => { var _a; return _a = class extends QuickForm.Quick(parent) { | ||
function Quick(parent) { | ||
class _ extends QuickForm.Quick(parent) { | ||
getAutoField() { | ||
@@ -17,5 +18,6 @@ return AutoField; | ||
} | ||
}, | ||
_a.Quick = Quick, | ||
_a; }; | ||
} | ||
_.Quick = Quick; | ||
return _; | ||
} | ||
export default Quick(BaseForm); |
@@ -1,2 +0,21 @@ | ||
declare const _default: any; | ||
import React, { HTMLProps } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type RadioFieldProps = Override<HTMLProps<HTMLDivElement>, { | ||
allowedValues: string[]; | ||
error?: boolean; | ||
inline?: boolean; | ||
inputClassName?: string; | ||
onChange: (string: any) => void; | ||
transform?: (string?: string) => string; | ||
}>; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<string | number | string[] | undefined>> & Pick<Override<React.HTMLProps<HTMLDivElement>, { | ||
allowedValues: string[]; | ||
error?: boolean | undefined; | ||
inline?: boolean | undefined; | ||
inputClassName?: string | undefined; | ||
onChange: (string: any) => void; | ||
transform?: ((string?: string | undefined) => string) | undefined; | ||
}>, "start" | "hidden" | "color" | "content" | "size" | "style" | "default" | "inline" | "wrap" | "open" | "multiple" | "cite" | "data" | "form" | "slot" | "span" | "summary" | "title" | "pattern" | "key" | "ref" | "children" | "list" | "step" | "async" | "noValidate" | "onSubmit" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "inputClassName" | "transform" | "allowedValues">>; | ||
export default _default; |
@@ -0,3 +1,3 @@ | ||
import classnames from 'classnames'; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { connectField } from 'uniforms'; | ||
@@ -9,10 +9,12 @@ import wrapField from './wrapField'; | ||
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', { | ||
'text-danger': props.error, | ||
'custom-control-inline': props.inline, | ||
}) }, | ||
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))))); | ||
function Radio(props) { | ||
return wrapField(props, props.allowedValues.map(item => (React.createElement("div", { key: item, className: classnames(props.inputClassName, 'form-check', 'radio', { | ||
'text-danger': props.error, | ||
'custom-control-inline': props.inline, | ||
}) }, | ||
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); |
@@ -1,2 +0,45 @@ | ||
declare const _default: any; | ||
import React, { HTMLProps, Ref } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type SelectFieldProps = Override<HTMLProps<HTMLDivElement>, { | ||
allowedValues?: string[]; | ||
checkboxes?: boolean; | ||
disabled: boolean; | ||
error?: unknown; | ||
errorMessage?: string; | ||
fieldType: unknown; | ||
id: string; | ||
inline?: string; | ||
inputClassName?: string; | ||
inputRef?: Ref<HTMLSelectElement>; | ||
label: string; | ||
name: string; | ||
onChange(value?: string | string[]): void; | ||
placeholder: string; | ||
required?: boolean; | ||
showInlineError?: boolean; | ||
transform?(value?: string): string; | ||
value?: string | string[]; | ||
}>; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<string | string[] | undefined>> & Pick<Override<React.HTMLProps<HTMLDivElement>, { | ||
allowedValues?: string[] | undefined; | ||
checkboxes?: boolean | undefined; | ||
disabled: boolean; | ||
error?: unknown; | ||
errorMessage?: string | undefined; | ||
fieldType: unknown; | ||
id: string; | ||
inline?: string | undefined; | ||
inputClassName?: string | undefined; | ||
inputRef?: ((instance: HTMLSelectElement | null) => void) | React.RefObject<HTMLSelectElement> | null | undefined; | ||
label: string; | ||
name: string; | ||
onChange(value?: string | string[] | undefined): void; | ||
placeholder: string; | ||
required?: boolean | undefined; | ||
showInlineError?: boolean | undefined; | ||
transform?(value?: string | undefined): string; | ||
value?: string | string[] | undefined; | ||
}>, "start" | "hidden" | "color" | "content" | "size" | "style" | "default" | "inline" | "wrap" | "open" | "multiple" | "cite" | "data" | "form" | "slot" | "span" | "summary" | "title" | "pattern" | "key" | "ref" | "children" | "list" | "step" | "async" | "noValidate" | "onSubmit" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "checkboxes" | "inputClassName" | "inputRef" | "transform" | "allowedValues">>; | ||
export default _default; |
@@ -0,3 +1,4 @@ | ||
import { __rest } from "tslib"; | ||
import classnames from 'classnames'; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { connectField } from 'uniforms'; | ||
@@ -16,16 +17,13 @@ import wrapField from './wrapField'; | ||
}; | ||
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}-${escape(item)}` }, | ||
React.createElement("input", { checked: props.fieldType === Array | ||
? props.value.includes(item) | ||
: 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)))); | ||
const renderSelect = props => (React.createElement("select", { className: classnames(props.inputClassName, 'c-select form-control', { | ||
'is-invalid': props.error, | ||
}), disabled: props.disabled, id: props.id, name: props.name, onChange: event => props.onChange(event.target.value !== '' ? event.target.value : undefined), ref: props.inputRef, value: props.value }, | ||
(!!props.placeholder || !props.required || props.value === '') && (React.createElement("option", { value: "", disabled: props.required, hidden: props.required }, props.placeholder || props.label)), | ||
props.allowedValues.map(value => (React.createElement("option", { key: value, value: value }, props.transform ? props.transform(value) : value))))); | ||
const Select = props => wrapField(props, props.checkboxes || props.fieldType === Array | ||
? renderCheckboxes(props) | ||
: renderSelect(props)); | ||
function Select(_a) { | ||
var { allowedValues, checkboxes, className, disabled, error, errorMessage, fieldType, id, inline, inputClassName, inputRef, label, name, onChange, placeholder, required, showInlineError, transform, value } = _a, props = __rest(_a, ["allowedValues", "checkboxes", "className", "disabled", "error", "errorMessage", "fieldType", "id", "inline", "inputClassName", "inputRef", "label", "name", "onChange", "placeholder", "required", "showInlineError", "transform", "value"]); | ||
return wrapField(Object.assign(Object.assign({}, props), { id, label }), checkboxes || fieldType === Array ? (allowedValues === null || allowedValues === void 0 ? void 0 : allowedValues.map(item => (React.createElement("div", { key: item, className: classnames(inputClassName, `checkbox${inline ? '-inline' : ''}`) }, | ||
React.createElement("label", { htmlFor: `${id}-${escape(item)}` }, | ||
React.createElement("input", { checked: fieldType === Array ? value === null || value === void 0 ? void 0 : value.includes(item) : value === item, disabled: disabled, id: `${id}-${escape(item)}`, name: name, onChange: () => onChange(fieldType === Array ? xor(item, value) : item), type: "checkbox" }), | ||
transform ? transform(item) : item))))) : (React.createElement("select", { className: classnames(inputClassName, 'c-select form-control', { | ||
'is-invalid': error, | ||
}), disabled: disabled, id: id, name: name, onChange: event => onChange(event.target.value !== '' ? event.target.value : undefined), ref: inputRef, value: value !== null && value !== void 0 ? value : '' }, | ||
(!!placeholder || !required || value === undefined) && (React.createElement("option", { value: "", disabled: required, hidden: required }, placeholder || label)), allowedValues === null || allowedValues === void 0 ? void 0 : | ||
allowedValues.map(value => (React.createElement("option", { key: value, value: value }, transform ? transform(value) : value)))))); | ||
} | ||
export default connectField(Select); |
@@ -1,8 +0,15 @@ | ||
/// <reference types="react" /> | ||
declare const SubmitField: { | ||
({ className, disabled, inputClassName, inputRef, value, wrapClassName, ...props }: any): JSX.Element; | ||
defaultProps: { | ||
import { HTMLProps, Ref } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type SubmitFieldProps = Override<HTMLProps<HTMLInputElement>, { | ||
inputClassName?: string; | ||
inputRef?: Ref<HTMLInputElement>; | ||
name: string; | ||
wrapClassName?: string; | ||
}>; | ||
declare function SubmitField({ className, disabled, inputClassName, inputRef, name, value, wrapClassName, ...props }: SubmitFieldProps): JSX.Element; | ||
declare namespace SubmitField { | ||
var defaultProps: { | ||
inputClassName: string; | ||
}; | ||
}; | ||
} | ||
export default SubmitField; |
import { __rest } from "tslib"; | ||
import React, { useContext } from 'react'; | ||
import classnames from 'classnames'; | ||
import { context, filterDOMProps } from 'uniforms'; | ||
import React from 'react'; | ||
import { filterDOMProps, useForm } from 'uniforms'; | ||
import gridClassName from './gridClassName'; | ||
const SubmitField = (_a) => { | ||
var { className, disabled, inputClassName, inputRef, value, wrapClassName } = _a, props = __rest(_a, ["className", "disabled", "inputClassName", "inputRef", "value", "wrapClassName"]); | ||
const { error, state } = useContext(context).uniforms; | ||
function SubmitField(_a) { | ||
var { className, disabled, inputClassName, inputRef, name, value, wrapClassName } = _a, props = __rest(_a, ["className", "disabled", "inputClassName", "inputRef", "name", "value", "wrapClassName"]); | ||
const { error, state: anyState } = useForm(); | ||
const state = anyState; | ||
const hasWrap = !!(state.grid || wrapClassName); | ||
@@ -18,4 +19,4 @@ const blockInput = (React.createElement("input", Object.assign({ className: inputClassName, disabled: disabled === undefined ? !!(error || state.disabled) : disabled, ref: inputRef, type: "submit" }, (value ? { value } : {})))); | ||
!hasWrap && blockInput)); | ||
}; | ||
} | ||
SubmitField.defaultProps = { inputClassName: 'btn btn-primary' }; | ||
export default SubmitField; |
@@ -1,2 +0,19 @@ | ||
declare const _default: any; | ||
import React, { HTMLProps, Ref } from 'react'; | ||
import { Override } from 'uniforms'; | ||
export declare type TextFieldProps = Override<HTMLProps<HTMLInputElement>, { | ||
error?: boolean; | ||
inputClassName?: string; | ||
inputRef?: Ref<HTMLInputElement>; | ||
onChange(value?: string): void; | ||
value?: string; | ||
}>; | ||
declare const _default: React.FunctionComponent<{ | ||
name: string; | ||
} & Partial<import("uniforms").GuaranteedProps<string | undefined>> & Pick<Override<React.HTMLProps<HTMLInputElement>, { | ||
error?: boolean | undefined; | ||
inputClassName?: string | undefined; | ||
inputRef?: ((instance: HTMLInputElement | null) => void) | React.RefObject<HTMLInputElement> | null | undefined; | ||
onChange(value?: string | undefined): void; | ||
value?: string | undefined; | ||
}>, "start" | "hidden" | "color" | "content" | "size" | "style" | "default" | "wrap" | "open" | "multiple" | "cite" | "data" | "form" | "slot" | "span" | "summary" | "title" | "pattern" | "key" | "ref" | "children" | "list" | "step" | "async" | "noValidate" | "onSubmit" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "inputClassName" | "inputRef">>; | ||
export default _default; |
@@ -0,9 +1,12 @@ | ||
import classnames from 'classnames'; | ||
import omit from 'lodash/omit'; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { connectField } from 'uniforms'; | ||
import wrapField from './wrapField'; | ||
const Text = props => wrapField(props, React.createElement("input", { className: classnames(props.inputClassName, 'form-control', { | ||
'is-invalid': props.error, | ||
}), disabled: props.disabled, id: props.id, name: props.name, onChange: event => props.onChange(event.target.value), placeholder: props.placeholder, ref: props.inputRef, type: props.type, value: props.value })); | ||
Text.defaultProps = { type: 'text' }; | ||
function Text(props) { | ||
var _a, _b; | ||
return wrapField(omit(props, ['value', 'onChange']), React.createElement("input", { className: classnames(props.inputClassName, 'form-control', { | ||
'is-invalid': props.error, | ||
}), disabled: props.disabled, id: props.id, name: props.name, onChange: event => props.onChange(event.target.value), placeholder: props.placeholder, ref: props.inputRef, type: (_a = props.type) !== null && _a !== void 0 ? _a : 'text', value: (_b = props.value) !== null && _b !== void 0 ? _b : '' })); | ||
} | ||
export default connectField(Text); |
import { ValidatedForm } from 'uniforms'; | ||
import BaseForm from './BaseForm'; | ||
const Validated = (parent) => { var _a; return _a = class extends ValidatedForm.Validated(parent) { | ||
}, | ||
_a.Validated = Validated, | ||
_a; }; | ||
function Validated(parent) { | ||
class _ extends ValidatedForm.Validated(parent) { | ||
} | ||
_.Validated = Validated; | ||
return _; | ||
} | ||
export default Validated(BaseForm); |
@@ -1,2 +0,13 @@ | ||
/// <reference types="react" /> | ||
import { HTMLProps, ReactNode } from 'react'; | ||
declare type WrapperProps = { | ||
error?: boolean; | ||
errorMessage?: string; | ||
grid?: object | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11; | ||
help?: string; | ||
helpClassName?: string; | ||
labelClassName?: string; | ||
showInlineError?: boolean; | ||
value?: boolean | string | number | string[] | undefined; | ||
wrapClassName?: string; | ||
} & Omit<HTMLProps<HTMLDivElement>, 'value'>; | ||
export default function wrapField({ className, disabled, error, errorMessage, grid, // Grid is either an number between 1 and 11 or an object with keys like xs and md. | ||
@@ -8,17 +19,3 @@ help, // Help text. | ||
wrapClassName, // Input wrapper class name. | ||
...props }: { | ||
[x: string]: any; | ||
className: any; | ||
disabled: any; | ||
error: any; | ||
errorMessage: any; | ||
grid: any; | ||
help: any; | ||
helpClassName: any; | ||
id: any; | ||
label: any; | ||
labelClassName: any; | ||
required: any; | ||
showInlineError: any; | ||
wrapClassName: any; | ||
}, children: any): JSX.Element; | ||
...props }: WrapperProps, children: ReactNode): JSX.Element; | ||
export {}; |
import { __rest } from "tslib"; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import omit from 'lodash/omit'; | ||
import React from 'react'; | ||
import { filterDOMProps } from 'uniforms'; | ||
@@ -6,0 +6,0 @@ import gridClassName from './gridClassName'; |
{ | ||
"name": "uniforms-bootstrap4", | ||
"version": "3.0.0-alpha.1", | ||
"version": "3.0.0-alpha.2", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"main": "es5/index.js", | ||
"module": "es6/index.js", | ||
@@ -21,4 +21,4 @@ "description": "Bootstrap4 UI components for uniforms.", | ||
"files": [ | ||
"*.d.ts", | ||
"*.js", | ||
"es5/*.d.ts", | ||
"es5/*.js", | ||
"es6/*.d.ts", | ||
@@ -37,6 +37,6 @@ "es6/*.js", | ||
"tslib": "^1.10.0", | ||
"uniforms": "^3.0.0-alpha.1", | ||
"uniforms": "^3.0.0-alpha.2", | ||
"warning": "^4.0.0" | ||
}, | ||
"gitHead": "a41746070b96b55bf96b0b97ccce0168f5102cd8" | ||
"gitHead": "a828a69acbfb54f1676e2340c4cea08aa0c41d19" | ||
} |
@@ -1,26 +0,25 @@ | ||
export { default as AutoFields } from './AutoFields'; | ||
export { default as AutoField } from './AutoField'; | ||
export { default as AutoField, AutoFieldProps } from './AutoField'; | ||
export { default as AutoFields, AutoFieldsProps } from './AutoFields'; | ||
export { default as AutoForm } from './AutoForm'; | ||
export { default as BaseForm } from './BaseForm'; | ||
export { default as BoolField } from './BoolField'; | ||
export { default as DateField } from './DateField'; | ||
export { default as ErrorField } from './ErrorField'; | ||
export { default as ErrorsField } from './ErrorsField'; | ||
export { default as FormGroup } from './FormGroup'; | ||
export { default as HiddenField } from './HiddenField'; | ||
export { default as ListAddField } from './ListAddField'; | ||
export { default as ListDelField } from './ListDelField'; | ||
export { default as ListField } from './ListField'; | ||
export { default as ListItemField } from './ListItemField'; | ||
export { default as LongTextField } from './LongTextField'; | ||
export { default as NestField } from './NestField'; | ||
export { default as NumField } from './NumField'; | ||
export { default as BoolField, BoolFieldProps } from './BoolField'; | ||
export { default as DateField, DateFieldProps } from './DateField'; | ||
export { default as ErrorField, ErrorFieldProps } from './ErrorField'; | ||
export { default as ErrorsField, ErrorsFieldProps } from './ErrorsField'; | ||
export { default as gridClassName } from './gridClassName'; | ||
export { default as HiddenField, HiddenFieldProps } from './HiddenField'; | ||
export { default as ListAddField, ListAddFieldProps } from './ListAddField'; | ||
export { default as ListDelField, ListDelFieldProps } from './ListDelField'; | ||
export { default as ListField, ListFieldProps } from './ListField'; | ||
export { default as ListItemField, ListItemFieldProps } from './ListItemField'; | ||
export { default as LongTextField, LongTextFieldProps } from './LongTextField'; | ||
export { default as NestField, NestFieldProps } from './NestField'; | ||
export { default as NumField, NumFieldProps } from './NumField'; | ||
export { default as QuickForm } from './QuickForm'; | ||
export { default as RadioField } from './RadioField'; | ||
export { default as SelectField } from './SelectField'; | ||
export { default as SubmitField } from './SubmitField'; | ||
export { default as TextField } from './TextField'; | ||
export { default as RadioField, RadioFieldProps } from './RadioField'; | ||
export { default as SelectField, SelectFieldProps } from './SelectField'; | ||
export { default as SubmitField, SubmitFieldProps } from './SubmitField'; | ||
export { default as TextField, TextFieldProps } from './TextField'; | ||
export { default as ValidatedForm } from './ValidatedForm'; | ||
export { default as ValidatedQuickForm } from './ValidatedQuickForm'; | ||
export { default as gridClassName } from './gridClassName'; | ||
export { default as wrapField } from './wrapField'; |
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
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
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
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
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
247568
3557
137
1
Updateduniforms@^3.0.0-alpha.2