@overmap-ai/forms 1.0.38 → 1.0.39-react-hook-form.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form/adapters.d.ts +3 -0
- package/dist/form/builder/Root.d.ts +0 -1
- package/dist/form/builder/components/FieldSettingsPopover.d.ts +0 -1
- package/dist/form/builder/context.d.ts +2 -0
- package/dist/form/builder/hooks.d.ts +1 -1
- package/dist/form/builder/utils.d.ts +2 -2
- package/dist/form/conditions/OTPFieldCondition/index.d.ts +1 -1
- package/dist/form/conditions/PassFailFieldCondition/index.d.ts +1 -1
- package/dist/form/conditions/URLFieldCondition/URLFieldCondition.d.ts +18 -0
- package/dist/form/conditions/URLFieldCondition/URLFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/URLFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/URLFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/constants.d.ts +2 -0
- package/dist/form/conditions/index.d.ts +1 -0
- package/dist/form/conditions/typings.d.ts +4 -3
- package/dist/form/fields/BaseField/BaseField.d.ts +2 -8
- package/dist/form/fields/BaseField/index.d.ts +1 -1
- package/dist/form/fields/BaseField/typings.d.ts +2 -2
- package/dist/form/fields/BaseFormElement/index.d.ts +1 -1
- package/dist/form/fields/BaseFormElement/typings.d.ts +0 -1
- package/dist/form/fields/BaseOptionsField/BaseOptionsField.d.ts +0 -1
- package/dist/form/fields/BaseOptionsField/index.d.ts +1 -1
- package/dist/form/fields/BaseStringField/index.d.ts +1 -1
- package/dist/form/fields/BooleanField/BooleanField.d.ts +0 -1
- package/dist/form/fields/BooleanField/index.d.ts +1 -1
- package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +0 -1
- package/dist/form/fields/CheckboxListField/index.d.ts +1 -1
- package/dist/form/fields/DateField/DateField.d.ts +0 -1
- package/dist/form/fields/DateField/index.d.ts +1 -1
- package/dist/form/fields/FieldSection/index.d.ts +1 -1
- package/dist/form/fields/MultiSelectField/index.d.ts +1 -1
- package/dist/form/fields/MultiStringField/MultiStringField.d.ts +0 -1
- package/dist/form/fields/MultiStringField/index.d.ts +1 -1
- package/dist/form/fields/NumberField/index.d.ts +1 -1
- package/dist/form/fields/PassFailField/PassFailField.d.ts +0 -1
- package/dist/form/fields/PassFailField/index.d.ts +1 -1
- package/dist/form/fields/RadioField/RadioField.d.ts +0 -1
- package/dist/form/fields/RadioField/index.d.ts +1 -1
- package/dist/form/fields/RatingField/cva.d.ts +3 -0
- package/dist/form/fields/RatingField/index.d.ts +1 -1
- package/dist/form/fields/ScanField/ScanField.d.ts +0 -1
- package/dist/form/fields/ScanField/index.d.ts +1 -1
- package/dist/form/fields/SelectField/index.d.ts +1 -1
- package/dist/form/fields/StringField/index.d.ts +1 -1
- package/dist/form/fields/TextField/index.d.ts +1 -1
- package/dist/form/fields/URLField/URLField.d.ts +28 -0
- package/dist/form/fields/URLField/URLField.test.d.ts +1 -0
- package/dist/form/fields/URLField/URLFieldInput.d.ts +7 -0
- package/dist/form/fields/URLField/index.d.ts +3 -0
- package/dist/form/fields/URLField/typings.d.ts +4 -0
- package/dist/form/fields/UploadField/UploadField.d.ts +0 -1
- package/dist/form/fields/UploadField/index.d.ts +1 -1
- package/dist/form/fields/components/InputWithLabel.d.ts +2 -3
- package/dist/form/fields/constants.d.ts +2 -0
- package/dist/form/fields/hooks.d.ts +10 -26
- package/dist/form/fields/index.d.ts +1 -0
- package/dist/form/fields/typings.d.ts +5 -3
- package/dist/form/index.d.ts +0 -1
- package/dist/form/renderer/FieldsRenderer.d.ts +3 -7
- package/dist/form/schema/FieldSchema.d.ts +1 -1
- package/dist/form/typings.d.ts +4 -2
- package/dist/form/utils.d.ts +2 -3
- package/dist/forms.js +4751 -4549
- package/dist/forms.umd.cjs +69 -59
- package/package.json +2 -2
- package/dist/form/constants.d.ts +0 -1
|
@@ -5,7 +5,6 @@ export interface FormBuilderRootProps extends PropsWithChildren {
|
|
|
5
5
|
initialFields?: SerializedFieldSection[];
|
|
6
6
|
onSave: FormBuilderSaveHandler;
|
|
7
7
|
onCancel?: () => void;
|
|
8
|
-
enableReinitialize?: boolean;
|
|
9
8
|
disableRequiredFields?: boolean;
|
|
10
9
|
}
|
|
11
10
|
export declare const FormBuilderRoot: import('react').NamedExoticComponent<FormBuilderRootProps>;
|
|
@@ -2,7 +2,6 @@ import { Popover } from '@overmap-ai/blocks';
|
|
|
2
2
|
import { ComponentProps, ReactNode } from 'react';
|
|
3
3
|
interface FieldSettingsPopoverProps extends Omit<ComponentProps<typeof Popover.Content>, "children"> {
|
|
4
4
|
popoverInputs: ReactNode;
|
|
5
|
-
hasError: boolean;
|
|
6
5
|
}
|
|
7
6
|
export declare const FieldSettingsPopover: import('react').MemoExoticComponent<(props: FieldSettingsPopoverProps) => import("react/jsx-runtime").JSX.Element>;
|
|
8
7
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { FormBuilderSaveHandler } from './typings';
|
|
1
2
|
interface IFormBuilderContext {
|
|
2
3
|
disableRequiredFields: boolean;
|
|
4
|
+
onSave: FormBuilderSaveHandler;
|
|
3
5
|
onCancel?: () => void;
|
|
4
6
|
}
|
|
5
7
|
export declare const FormBuilderContext: import('react').Context<IFormBuilderContext>;
|
|
@@ -2,6 +2,6 @@ import { FieldType } from '../fields';
|
|
|
2
2
|
export declare const useFieldTypeItems: (onSelect?: (type: Exclude<FieldType, "section">) => void) => {
|
|
3
3
|
children: string;
|
|
4
4
|
icon: import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
value: "string" | "number" | "boolean" | "select" | "text" | "radio" | "date" | "checkbox-list" | "pass-fail" | "multi-select" | "multi-string" | "rating" | "qr" | "upload" | "otp";
|
|
5
|
+
value: "string" | "number" | "boolean" | "select" | "text" | "radio" | "url" | "date" | "checkbox-list" | "pass-fail" | "multi-select" | "multi-string" | "rating" | "qr" | "upload" | "otp";
|
|
6
6
|
onSelect: () => void;
|
|
7
7
|
}[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BooleanFieldCondition, CheckboxListFieldCondition, DateFieldCondition, MultiSelectFieldCondition, MultiStringFieldCondition, NumberFieldCondition, OTPFieldCondition, PassFailFieldCondition, RadioFieldCondition, RatingFieldCondition, ScanFieldCondition, SelectFieldCondition, StringFieldCondition, TextFieldCondition, UploadFieldCondition } from '../conditions';
|
|
1
|
+
import { BooleanFieldCondition, CheckboxListFieldCondition, DateFieldCondition, MultiSelectFieldCondition, MultiStringFieldCondition, NumberFieldCondition, OTPFieldCondition, PassFailFieldCondition, RadioFieldCondition, RatingFieldCondition, ScanFieldCondition, SelectFieldCondition, StringFieldCondition, TextFieldCondition, UploadFieldCondition, URLFieldCondition } from '../conditions';
|
|
2
2
|
import { Field, FieldCreationSchemaObject, FieldType } from '../fields';
|
|
3
3
|
export declare const createField: (type: Exclude<FieldType, "section">) => Field;
|
|
4
|
-
export declare const createCondition: (field: Field) => BooleanFieldCondition | CheckboxListFieldCondition | DateFieldCondition | MultiSelectFieldCondition | MultiStringFieldCondition | NumberFieldCondition | OTPFieldCondition | PassFailFieldCondition | RadioFieldCondition | RatingFieldCondition | ScanFieldCondition | SelectFieldCondition | StringFieldCondition | TextFieldCondition | UploadFieldCondition;
|
|
4
|
+
export declare const createCondition: (field: Field) => BooleanFieldCondition | CheckboxListFieldCondition | DateFieldCondition | MultiSelectFieldCondition | MultiStringFieldCondition | NumberFieldCondition | OTPFieldCondition | PassFailFieldCondition | RadioFieldCondition | RatingFieldCondition | ScanFieldCondition | SelectFieldCondition | StringFieldCondition | TextFieldCondition | UploadFieldCondition | URLFieldCondition;
|
|
5
5
|
export declare const getFieldCreationSchema: (type: FieldType, path: string) => FieldCreationSchemaObject[] | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SerializedURLCondition, URLConditionModifiers } from './typings';
|
|
3
|
+
import { URLField, ValueOfField } from '../../fields';
|
|
4
|
+
import { BaseCondition, BaseConditionOptions, ConditionRenderProps } from '../BaseCondition';
|
|
5
|
+
export interface URLFieldConditionOptions extends BaseConditionOptions<URLField, string, URLConditionModifiers> {
|
|
6
|
+
}
|
|
7
|
+
export declare class URLFieldCondition extends BaseCondition<URLField, string, string, string, URLConditionModifiers, URLFieldCondition> {
|
|
8
|
+
readonly modifiers: {
|
|
9
|
+
equals: import('../..').FieldConditionModifierConfig<string, string, string, string, string, string>;
|
|
10
|
+
notEquals: import('../..').FieldConditionModifierConfig<string, string, string, string, string, string>;
|
|
11
|
+
includes: import('../..').FieldConditionModifierConfig<string, string, string, string, string, string>;
|
|
12
|
+
excludes: import('../..').FieldConditionModifierConfig<string, string, string, string, string, string>;
|
|
13
|
+
};
|
|
14
|
+
constructor(options: URLFieldConditionOptions);
|
|
15
|
+
transformValue(value: ValueOfField<URLField>): string;
|
|
16
|
+
static deserialize(serializedCondition: SerializedURLCondition, field: URLField): URLFieldCondition;
|
|
17
|
+
render(props: ConditionRenderProps<URLFieldCondition>): ReactNode;
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseConditionCellProps } from '../BaseCondition';
|
|
2
|
+
import { URLFieldCondition } from './URLFieldCondition';
|
|
3
|
+
interface URLFieldConditionCellProps extends BaseConditionCellProps<URLFieldCondition> {
|
|
4
|
+
}
|
|
5
|
+
export declare const URLFieldConditionCell: (props: URLFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TypeOfField, URLField } from '../../fields';
|
|
2
|
+
import { BaseSerializedCondition } from '../BaseCondition';
|
|
3
|
+
export type URLConditionModifiers = "equals" | "notEquals" | "includes" | "excludes";
|
|
4
|
+
export type SerializedURLCondition = BaseSerializedCondition<TypeOfField<URLField>, string, URLConditionModifiers>;
|
|
@@ -13,12 +13,14 @@ import { SelectFieldCondition } from './SelectFieldCondition';
|
|
|
13
13
|
import { StringFieldCondition } from './StringFieldCondition';
|
|
14
14
|
import { TextFieldCondition } from './TextFieldCondition';
|
|
15
15
|
import { UploadFieldCondition } from './UploadFieldCondition';
|
|
16
|
+
import { URLFieldCondition } from './URLFieldCondition';
|
|
16
17
|
export declare const ConditionTypeToClsMapping: {
|
|
17
18
|
date: typeof DateFieldCondition;
|
|
18
19
|
number: typeof NumberFieldCondition;
|
|
19
20
|
boolean: typeof BooleanFieldCondition;
|
|
20
21
|
select: typeof SelectFieldCondition;
|
|
21
22
|
string: typeof StringFieldCondition;
|
|
23
|
+
url: typeof URLFieldCondition;
|
|
22
24
|
text: typeof TextFieldCondition;
|
|
23
25
|
upload: typeof UploadFieldCondition;
|
|
24
26
|
qr: typeof ScanFieldCondition;
|
|
@@ -14,9 +14,10 @@ import { SelectFieldCondition, SerializedSelectCondition } from './SelectFieldCo
|
|
|
14
14
|
import { SerializedStringCondition, StringFieldCondition } from './StringFieldCondition';
|
|
15
15
|
import { SerializedTextCondition, TextFieldCondition } from './TextFieldCondition';
|
|
16
16
|
import { SerializedUploadCondition, UploadFieldCondition } from './UploadFieldCondition';
|
|
17
|
-
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
17
|
+
import { SerializedURLCondition, URLFieldCondition } from './URLFieldCondition';
|
|
18
|
+
export type Condition = BooleanFieldCondition | CheckboxListFieldCondition | PassFailFieldCondition | DateFieldCondition | MultiSelectFieldCondition | MultiStringFieldCondition | NumberFieldCondition | RadioFieldCondition | RatingFieldCondition | ScanFieldCondition | SelectFieldCondition | StringFieldCondition | TextFieldCondition | UploadFieldCondition | URLFieldCondition | OTPFieldCondition;
|
|
19
|
+
export type SerializedCondition = SerializedTextCondition | SerializedBooleanCondition | SerializedNumberCondition | SerializedDateCondition | SerializedStringCondition | SerializedURLCondition | SerializedSelectCondition | SerializedMultiStringCondition | SerializedMultiSelectCondition | SerializedUploadCondition | SerializedScanCondition | SerializedRadioCondition | SerializedRatingCondition | SerializedCheckboxListCondition | SerializedPassFailFieldCondition | SerializedOTPCondition;
|
|
20
|
+
export type ConditionClass = typeof BooleanFieldCondition | typeof CheckboxListFieldCondition | typeof PassFailFieldCondition | typeof DateFieldCondition | typeof MultiSelectFieldCondition | typeof MultiStringFieldCondition | typeof NumberFieldCondition | typeof RadioFieldCondition | typeof RatingFieldCondition | typeof ScanFieldCondition | typeof SelectFieldCondition | typeof StringFieldCondition | typeof TextFieldCondition | typeof UploadFieldCondition | typeof URLFieldCondition | typeof OTPFieldCondition;
|
|
20
21
|
export interface FieldConditionManager<TCondition extends AnyCondition> {
|
|
21
22
|
readonly conditions: Record<string, TCondition[]>;
|
|
22
23
|
getConditions(identifier: string): TCondition[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FieldError } from '../typings';
|
|
1
2
|
import { BaseSerializedField, FieldOptions, FieldValidator } from './typings';
|
|
2
3
|
import { BaseFormElement } from '../BaseFormElement';
|
|
3
4
|
export declare abstract class BaseField<TType extends string, TValue, TSerializedValue, This extends BaseField<TType, TValue, TSerializedValue, This>> extends BaseFormElement<TType, This> {
|
|
@@ -7,15 +8,8 @@ export declare abstract class BaseField<TType extends string, TValue, TSerialize
|
|
|
7
8
|
description: string | null;
|
|
8
9
|
required: boolean;
|
|
9
10
|
image: File | Promise<File> | undefined;
|
|
10
|
-
/**
|
|
11
|
-
* By default, validation doesn't execute on `onChange` events when editing fields
|
|
12
|
-
* until the field has been `touched`. This can be overridden by setting this to `false`
|
|
13
|
-
* if you want to validate on every `onChange` event. This is important for fields like booleans
|
|
14
|
-
* which don't have a `onBlur` event (which is used to set the `touched` state).
|
|
15
|
-
*/
|
|
16
|
-
readonly onlyValidateAfterTouched: boolean;
|
|
17
11
|
protected constructor(options: FieldOptions);
|
|
18
|
-
getError(value: TValue):
|
|
12
|
+
getError(value: TValue): FieldError | undefined;
|
|
19
13
|
serialize(): BaseSerializedField<TType>;
|
|
20
14
|
getOptions(): FieldOptions;
|
|
21
15
|
setOptions(options: Partial<FieldOptions>): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './BaseField';
|
|
2
|
-
export * from './typings';
|
|
2
|
+
export type * from './typings';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseFormElementOptions, BaseSerializedFormElement } from '../BaseFormElement';
|
|
2
|
-
import { AnyField } from '../typings';
|
|
2
|
+
import { AnyField, FieldError } from '../typings';
|
|
3
3
|
export interface BaseSerializedField<TType extends string> extends BaseSerializedFormElement<TType> {
|
|
4
4
|
label: string;
|
|
5
5
|
description?: string | null;
|
|
@@ -16,4 +16,4 @@ export interface FieldCreationSchemaObject {
|
|
|
16
16
|
field: AnyField;
|
|
17
17
|
showDirectly: boolean;
|
|
18
18
|
}
|
|
19
|
-
export type FieldValidator<TValue> = (value: TValue) =>
|
|
19
|
+
export type FieldValidator<TValue> = (value: TValue) => FieldError | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './BaseFormElement';
|
|
2
|
-
export * from './typings';
|
|
2
|
+
export type * from './typings';
|
|
@@ -5,7 +5,6 @@ export interface BaseOptionsFieldOptions extends FieldOptions {
|
|
|
5
5
|
}
|
|
6
6
|
export declare abstract class BaseOptionsField<TType extends string, TValue, TSerializedValue, This extends BaseOptionsField<TType, TValue, TSerializedValue, This>> extends BaseField<TType, TValue, TSerializedValue, This> {
|
|
7
7
|
options: SelectFieldOption[];
|
|
8
|
-
readonly onlyValidateAfterTouched = false;
|
|
9
8
|
protected constructor(options: BaseOptionsFieldOptions);
|
|
10
9
|
serialize(): BaseSerializedOptionsField<TType>;
|
|
11
10
|
getOptions(): BaseOptionsFieldOptions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './BaseOptionsField';
|
|
2
|
-
export * from './typings';
|
|
2
|
+
export type * from './typings';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './BaseStringField';
|
|
2
|
-
export * from './typings';
|
|
2
|
+
export type * from './typings';
|
|
@@ -7,7 +7,6 @@ export declare class BooleanField extends BaseField<"boolean", boolean, boolean,
|
|
|
7
7
|
readonly type = "boolean";
|
|
8
8
|
static readonly fieldTypeName = "Checkbox";
|
|
9
9
|
static readonly fieldTypeDescription = "Perfect for both optional and required yes/no questions.";
|
|
10
|
-
readonly onlyValidateAfterTouched: boolean;
|
|
11
10
|
constructor(options: BooleanFieldOptions);
|
|
12
11
|
serialize(): SerializedBooleanField;
|
|
13
12
|
getOptions(): BooleanFieldOptions;
|
|
@@ -6,7 +6,6 @@ export interface CheckboxListFieldOptions extends BaseOptionsFieldOptions {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class CheckboxListField extends BaseOptionsField<"checkbox-list", string[], string[], CheckboxListField> {
|
|
8
8
|
readonly type = "checkbox-list";
|
|
9
|
-
readonly onlyValidateAfterTouched = false;
|
|
10
9
|
static readonly fieldTypeName = "Checkbox list";
|
|
11
10
|
static readonly fieldTypeDescription = "Allows the user to select a multiple options from a list.";
|
|
12
11
|
constructor(options: CheckboxListFieldOptions);
|
|
@@ -12,7 +12,6 @@ export declare class DateField extends BaseField<"date", Date | null, string | n
|
|
|
12
12
|
readonly type = "date";
|
|
13
13
|
static readonly fieldTypeName = "Date";
|
|
14
14
|
static readonly fieldTypeDescription = "Allows specifying a date.";
|
|
15
|
-
readonly onlyValidateAfterTouched: boolean;
|
|
16
15
|
constructor(options: DateFieldOptions);
|
|
17
16
|
serialize(): SerializedDateField;
|
|
18
17
|
getOptions(): DateFieldOptions;
|
|
@@ -14,7 +14,6 @@ export declare class MultiStringField extends BaseField<"multi-string", string[]
|
|
|
14
14
|
minLength: number;
|
|
15
15
|
maxLength: number;
|
|
16
16
|
placeholder: string;
|
|
17
|
-
readonly onlyValidateAfterTouched = false;
|
|
18
17
|
constructor(options: MultiStringFieldOptions);
|
|
19
18
|
render(props: FieldRenderProps): ReactNode;
|
|
20
19
|
serialize(): SerializedMultiStringField;
|
|
@@ -9,7 +9,6 @@ export declare class PassFailField extends BaseField<"pass-fail", PassFailFieldV
|
|
|
9
9
|
readonly type = "pass-fail";
|
|
10
10
|
static readonly fieldTypeName = "Pass - Fail";
|
|
11
11
|
static readonly fieldTypeDescription = "Track pass, fail, or N/A outcome.";
|
|
12
|
-
readonly onlyValidateAfterTouched = false;
|
|
13
12
|
showNotesAndFilesOn: PassFailFieldStatus[];
|
|
14
13
|
constructor(options: PassFailFieldOptions);
|
|
15
14
|
static getFieldCreationSchema(parentPath?: string): FieldCreationSchemaObject[];
|
|
@@ -6,7 +6,6 @@ export interface RadioFieldOptions extends BaseOptionsFieldOptions {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class RadioField extends BaseOptionsField<"radio", string | null, string | null, RadioField> {
|
|
8
8
|
readonly type = "radio";
|
|
9
|
-
readonly onlyValidateAfterTouched = false;
|
|
10
9
|
static readonly fieldTypeName = "Option list";
|
|
11
10
|
static readonly fieldTypeDescription = "Allows the user to select a single option from a list of options.";
|
|
12
11
|
constructor(options: RadioFieldOptions);
|
|
@@ -8,7 +8,6 @@ export declare class ScanField extends BaseField<"qr", string, string, ScanField
|
|
|
8
8
|
readonly type = "qr";
|
|
9
9
|
static readonly fieldTypeName = "Scan";
|
|
10
10
|
static readonly fieldTypeDescription = "Used for scanning/reading QR and barcodes.";
|
|
11
|
-
readonly onlyValidateAfterTouched = false;
|
|
12
11
|
constructor(options: ScanFieldOptions);
|
|
13
12
|
serialize(): SerializedScanField;
|
|
14
13
|
getOptions(): ScanFieldOptions;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SerializedURLField } from './typings';
|
|
3
|
+
import { BaseField, FieldOptions } from '../BaseField';
|
|
4
|
+
import { FieldRenderProps } from '../BaseFormElement';
|
|
5
|
+
export interface URLFieldOptions extends FieldOptions {
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class URLField extends BaseField<"url", URL | null, string | null, URLField> {
|
|
9
|
+
readonly type = "url";
|
|
10
|
+
static readonly fieldTypeName = "URL";
|
|
11
|
+
static readonly fieldTypeDescription = "Allows users to enter a URL.";
|
|
12
|
+
placeholder: string;
|
|
13
|
+
constructor(options: URLFieldOptions);
|
|
14
|
+
serialize(): SerializedURLField;
|
|
15
|
+
getOptions(): URLFieldOptions;
|
|
16
|
+
duplicate(identifier: string): URLField;
|
|
17
|
+
setOptions(options: Partial<URLFieldOptions>): void;
|
|
18
|
+
static deserialize(data: SerializedURLField): URLField;
|
|
19
|
+
serializeValue(value: URL | null): string | null;
|
|
20
|
+
deserializeValue(value: string | null): URL | null;
|
|
21
|
+
isSerializedValue(value: unknown): value is string | null;
|
|
22
|
+
isValue(value: unknown): value is URL | null;
|
|
23
|
+
blankValue(): URL | null;
|
|
24
|
+
blankSerializedValue(): string | null;
|
|
25
|
+
areSerializedValuesEqual(value1: string | null, value2: string | null): boolean;
|
|
26
|
+
areValuesEqual(value1: URL | null, value2: URL | null): boolean;
|
|
27
|
+
render(props: FieldRenderProps): ReactNode;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { URLField } from './URLField';
|
|
2
|
+
import { FieldRenderProps } from '../BaseFormElement';
|
|
3
|
+
interface URLFieldInputProps extends FieldRenderProps {
|
|
4
|
+
field: URLField;
|
|
5
|
+
}
|
|
6
|
+
export declare const URLFieldInput: import('react').NamedExoticComponent<URLFieldInputProps>;
|
|
7
|
+
export {};
|
|
@@ -18,7 +18,6 @@ export declare class UploadField extends BaseField<"upload", (UUIDPromise<UUIDFi
|
|
|
18
18
|
extensions?: string[];
|
|
19
19
|
maxFileSize: number | undefined;
|
|
20
20
|
maxFiles: number;
|
|
21
|
-
readonly onlyValidateAfterTouched = false;
|
|
22
21
|
constructor(options: UploadFieldOptions);
|
|
23
22
|
static getFieldCreationSchema(parentPath?: string): ({
|
|
24
23
|
field: NumberField;
|
|
@@ -3,12 +3,11 @@ import { FieldsRendererSize } from '../../renderer';
|
|
|
3
3
|
export interface InputWithLabelProps {
|
|
4
4
|
size: FieldsRendererSize;
|
|
5
5
|
inputId: string;
|
|
6
|
-
labelId: string;
|
|
7
6
|
label: string;
|
|
8
|
-
|
|
7
|
+
required: boolean;
|
|
8
|
+
description?: string | null;
|
|
9
9
|
image: File | Promise<File> | undefined;
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
error: string;
|
|
12
|
-
className?: string;
|
|
13
12
|
}
|
|
14
13
|
export declare const InputWithLabel: import('react').MemoExoticComponent<(props: InputWithLabelProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -15,12 +15,14 @@ import { SelectField } from './SelectField';
|
|
|
15
15
|
import { StringField } from './StringField';
|
|
16
16
|
import { TextField } from './TextField';
|
|
17
17
|
import { UploadField } from './UploadField';
|
|
18
|
+
import { URLField } from './URLField';
|
|
18
19
|
export declare const FieldTypeToClsMapping: {
|
|
19
20
|
date: typeof DateField;
|
|
20
21
|
number: typeof NumberField;
|
|
21
22
|
boolean: typeof BooleanField;
|
|
22
23
|
select: typeof SelectField;
|
|
23
24
|
string: typeof StringField;
|
|
25
|
+
url: typeof URLField;
|
|
24
26
|
text: typeof TextField;
|
|
25
27
|
upload: typeof UploadField;
|
|
26
28
|
qr: typeof ScanField;
|
|
@@ -2,30 +2,14 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { AnyField, AnyFormElement, ValueOfField } from './typings';
|
|
3
3
|
import { FieldRenderProps } from './BaseFormElement';
|
|
4
4
|
export declare const useFieldInputs: (fields: AnyFormElement[], props: Omit<FieldRenderProps, "index">) => ReactNode;
|
|
5
|
-
export
|
|
5
|
+
export interface useFieldInputProps<TField extends AnyField> {
|
|
6
6
|
field: TField;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
onChange: (value: ValueOfField<TField>) => void;
|
|
17
|
-
onBlur: (value: ValueOfField<TField>) => void;
|
|
18
|
-
value: ValueOfField<TField>;
|
|
19
|
-
name: string;
|
|
20
|
-
multiple?: boolean;
|
|
21
|
-
checked?: boolean;
|
|
22
|
-
};
|
|
23
|
-
readonly helpers: import('formik').FieldHelperProps<ValueOfField<TField>>;
|
|
24
|
-
readonly field: TField;
|
|
25
|
-
readonly touched: boolean;
|
|
26
|
-
}, {
|
|
27
|
-
readonly "aria-labelledby": string;
|
|
28
|
-
readonly formId: string;
|
|
29
|
-
readonly index: number;
|
|
30
|
-
readonly disabled?: boolean;
|
|
31
|
-
}];
|
|
7
|
+
}
|
|
8
|
+
export declare const useFieldInput: <TField extends AnyField>(props: useFieldInputProps<TField>) => {
|
|
9
|
+
value: ValueOfField<TField>;
|
|
10
|
+
name: TField["identifier"];
|
|
11
|
+
isTouched: boolean;
|
|
12
|
+
error: string;
|
|
13
|
+
onChange: (value: ValueOfField<TField>) => void;
|
|
14
|
+
onBlur: import('react-hook-form').Noop;
|
|
15
|
+
};
|
|
@@ -16,17 +16,19 @@ import { SelectField, SerializedSelectField } from './SelectField';
|
|
|
16
16
|
import { SerializedStringField, StringField } from './StringField';
|
|
17
17
|
import { SerializedTextField, TextField } from './TextField';
|
|
18
18
|
import { SerializedUploadField, UploadField } from './UploadField';
|
|
19
|
+
import { SerializedURLField, URLField } from './URLField';
|
|
19
20
|
export type AnyFormElement = BaseFormElement<any, any>;
|
|
20
21
|
export type AnyField = BaseField<any, any, any, any>;
|
|
21
22
|
export type TypeOfField<TField extends AnyFormElement> = TField extends BaseFormElement<infer TType, infer _TThis> ? TType : never;
|
|
22
23
|
export type ValueOfField<TField extends AnyField> = TField extends BaseField<infer _TType, infer TValue, infer _TSerializedValue, infer _TThis> ? TValue : never;
|
|
23
24
|
export type SerializedValueOfField<TField extends AnyField> = TField extends BaseField<infer _TType, infer _TValue, infer TSerializedValue, infer _TThis> ? TSerializedValue : never;
|
|
24
|
-
export type Field = BooleanField | CheckboxListField | PassFailField | DateField | MultiSelectField | MultiStringField | NumberField | RadioField | RatingField | ScanField | SelectField | StringField | TextField | UploadField | OTPField;
|
|
25
|
-
export type FieldClass = typeof BooleanField | typeof CheckboxListField | typeof PassFailField | typeof DateField | typeof MultiSelectField | typeof MultiStringField | typeof NumberField | typeof RadioField | typeof RatingField | typeof ScanField | typeof SelectField | typeof StringField | typeof TextField | typeof UploadField | typeof OTPField;
|
|
25
|
+
export type Field = BooleanField | CheckboxListField | PassFailField | DateField | MultiSelectField | MultiStringField | NumberField | RadioField | RatingField | ScanField | SelectField | StringField | TextField | UploadField | URLField | OTPField;
|
|
26
|
+
export type FieldClass = typeof BooleanField | typeof CheckboxListField | typeof PassFailField | typeof DateField | typeof MultiSelectField | typeof MultiStringField | typeof NumberField | typeof RadioField | typeof RatingField | typeof ScanField | typeof SelectField | typeof StringField | typeof TextField | typeof UploadField | typeof URLField | typeof OTPField;
|
|
26
27
|
export type FieldType = TypeOfField<Field> | TypeOfField<FieldSection>;
|
|
27
28
|
export type FieldValue = ValueOfField<Field>;
|
|
29
|
+
export type FieldError = string;
|
|
28
30
|
export type SerializedFieldValue = SerializedValueOfField<Field>;
|
|
29
|
-
export type SerializedField = SerializedTextField | SerializedBooleanField | SerializedNumberField | SerializedDateField | SerializedStringField | SerializedSelectField | SerializedFieldSection | SerializedMultiStringField | SerializedMultiSelectField | SerializedUploadField | SerializedScanField | SerializedRadioField | SerializedRatingField | SerializedCheckboxListField | SerializedOTPField | SerializedPassFailField;
|
|
31
|
+
export type SerializedField = SerializedTextField | SerializedBooleanField | SerializedNumberField | SerializedDateField | SerializedStringField | SerializedURLField | SerializedSelectField | SerializedFieldSection | SerializedMultiStringField | SerializedMultiSelectField | SerializedUploadField | SerializedScanField | SerializedRadioField | SerializedRatingField | SerializedCheckboxListField | SerializedOTPField | SerializedPassFailField;
|
|
30
32
|
export type SerializedOnlyField = Exclude<SerializedField, SerializedFieldSection>;
|
|
31
33
|
export interface FieldsManager {
|
|
32
34
|
readonly fields: Field[];
|
package/dist/form/index.d.ts
CHANGED
|
@@ -3,20 +3,16 @@ import { FieldValues } from '../typings';
|
|
|
3
3
|
import { FieldsRendererSize } from './typings';
|
|
4
4
|
import { FieldSchema } from '../schema';
|
|
5
5
|
interface FieldsRendererProps {
|
|
6
|
-
|
|
6
|
+
disabled?: boolean;
|
|
7
7
|
fieldSchema: FieldSchema;
|
|
8
8
|
values?: FieldValues;
|
|
9
|
-
onValuesChange?: (
|
|
10
|
-
enableReinitialize?: boolean;
|
|
11
|
-
excludeUnchangedFields?: boolean;
|
|
9
|
+
onValuesChange?: (values: FieldValues) => void;
|
|
12
10
|
hideSubmit?: boolean;
|
|
13
|
-
onSubmit?: (values: FieldValues) =>
|
|
11
|
+
onSubmit?: (values: FieldValues) => void;
|
|
14
12
|
submitText?: string;
|
|
15
13
|
hideCancel?: boolean;
|
|
16
14
|
cancelText?: string;
|
|
17
15
|
onCancel?: () => void;
|
|
18
|
-
onDirty?: () => void;
|
|
19
|
-
onDirtyChange?: (dirty: boolean) => void;
|
|
20
16
|
className?: string;
|
|
21
17
|
buttonProps?: Omit<ButtonProps, "children">;
|
|
22
18
|
size?: FieldsRendererSize;
|
|
@@ -24,7 +24,7 @@ export declare class FieldSchema extends Observable<FieldSchema> implements Fiel
|
|
|
24
24
|
deserializeValues(values: SerializedFieldValues, clean?: boolean): FieldValues;
|
|
25
25
|
serializeValues(values: FieldValues, clean?: boolean): SerializedFieldValues;
|
|
26
26
|
initializeValues(values: FieldValues): FieldValues;
|
|
27
|
-
validateValues(values: FieldValues): import('
|
|
27
|
+
validateValues(values: FieldValues): import('..').FieldErrors;
|
|
28
28
|
deserializeConditions(serializedConditions: SerializedCondition[]): Condition[];
|
|
29
29
|
cleanConditions(conditions: Condition[]): Condition[];
|
|
30
30
|
serializeConditions(conditions: Condition[]): SerializedCondition[];
|