@overmap-ai/forms 1.0.32-react-flow-david-fixes.41 → 1.0.33-toast-migration.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/Observable/index.d.ts +1 -0
- package/dist/form/UUIDFile/UUIDFile.d.ts +5 -0
- package/dist/form/UUIDFile/index.d.ts +1 -0
- package/dist/form/{fields/UploadField → UUIDPromise}/UUIDPromise.d.ts +3 -3
- package/dist/form/UUIDPromise/index.d.ts +2 -0
- package/dist/form/UUIDPromise/utils.d.ts +4 -0
- package/dist/form/builder/Root.d.ts +1 -1
- package/dist/form/builder/components/CreateFieldDropdownMenu.d.ts +8 -0
- package/dist/form/builder/components/FieldBuilder.d.ts +2 -2
- package/dist/form/builder/components/FieldBuilderWithActions.d.ts +9 -0
- package/dist/form/builder/components/index.d.ts +2 -1
- package/dist/form/builder/hooks.d.ts +1 -1
- package/dist/form/builder/list/FieldSectionWithActions.d.ts +1 -1
- package/dist/form/builder/utils.d.ts +2 -2
- package/dist/form/components/DisplayFile.d.ts +9 -0
- package/dist/form/components/index.d.ts +1 -0
- package/dist/form/conditions/BaseCondition/BaseCondition.d.ts +7 -8
- package/dist/form/conditions/BaseCondition/typings.d.ts +4 -4
- package/dist/form/conditions/BooleanFieldCondition/BooleanFieldCondition.d.ts +4 -6
- package/dist/form/conditions/CheckboxListFieldCondition/CheckboxListFieldCondition.d.ts +4 -6
- package/dist/form/conditions/ConditionManager/ConditionManager.d.ts +15 -0
- package/dist/form/conditions/ConditionManager/hooks.d.ts +4 -0
- package/dist/form/conditions/ConditionManager/index.d.ts +3 -0
- package/dist/form/conditions/ConditionManager/typings.d.ts +2 -0
- package/dist/form/conditions/DateFieldCondition/DateFieldCondition.d.ts +5 -7
- package/dist/form/conditions/MultiSelectFieldCondition/MultiSelectFieldCondition.d.ts +4 -14
- package/dist/form/conditions/MultiStringFieldCondition/MultiStringFieldCondition.d.ts +4 -6
- package/dist/form/conditions/NumberFieldCondition/NumberFieldCondition.d.ts +4 -17
- package/dist/form/conditions/OTPFieldCondition/OTPFieldCondition.d.ts +4 -6
- package/dist/form/conditions/PassFailFieldCondition/PassFailFieldCondition.d.ts +18 -0
- package/dist/form/conditions/PassFailFieldCondition/PassFailFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/PassFailFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/PassFailFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/RadioFieldCondition/RadioFieldCondition.d.ts +4 -6
- package/dist/form/conditions/RatingFieldCondition/RatingFieldCondition.d.ts +21 -0
- package/dist/form/conditions/RatingFieldCondition/RatingFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/RatingFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/RatingFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/ScanFieldCondition/ScanFieldCondition.d.ts +4 -6
- package/dist/form/conditions/SelectFieldCondition/SelectFieldCondition.d.ts +4 -6
- package/dist/form/conditions/StringFieldCondition/StringFieldCondition.d.ts +4 -6
- package/dist/form/conditions/TextFieldCondition/TextFieldCondition.d.ts +4 -6
- package/dist/form/conditions/UploadFieldCondition/UploadFieldCondition.d.ts +8 -8
- package/dist/form/conditions/constants.d.ts +32 -0
- package/dist/form/conditions/index.d.ts +3 -0
- package/dist/form/conditions/typings.d.ts +6 -3
- package/dist/form/conditions/utils.d.ts +4 -5
- package/dist/form/fields/BaseField/BaseField.d.ts +6 -7
- package/dist/form/fields/BaseField/typings.d.ts +3 -4
- package/dist/form/fields/BaseFormElement/BaseFormElement.d.ts +9 -9
- package/dist/form/fields/BaseFormElement/typings.d.ts +3 -3
- package/dist/form/fields/BaseOptionsField/BaseOptionsField.d.ts +7 -7
- package/dist/form/fields/BaseOptionsField/typings.d.ts +2 -2
- package/dist/form/fields/BaseStringField/BaseStringField.d.ts +4 -4
- package/dist/form/fields/BaseStringField/typings.d.ts +1 -1
- package/dist/form/fields/BooleanField/BooleanField.d.ts +3 -4
- package/dist/form/fields/BooleanField/BooleanInput.d.ts +1 -1
- package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +2 -2
- package/dist/form/fields/DateField/DateField.d.ts +2 -2
- package/dist/form/fields/DateField/DateInput.d.ts +1 -1
- package/dist/form/fields/FieldSection/FieldSection.d.ts +6 -8
- package/dist/form/fields/FieldSection/typings.d.ts +2 -2
- package/dist/form/fields/MultiSelectField/MultiSelectField.d.ts +2 -2
- package/dist/form/fields/MultiSelectField/MultiSelectInput.d.ts +1 -1
- package/dist/form/fields/MultiStringField/MultiStringField.d.ts +2 -2
- package/dist/form/fields/MultiStringField/MultiStringInput.d.ts +1 -1
- package/dist/form/fields/NumberField/NumberField.d.ts +2 -2
- package/dist/form/fields/NumberField/NumberInput.d.ts +1 -1
- package/dist/form/fields/OneTimePasswordField/OTPField.d.ts +2 -2
- package/dist/form/fields/OneTimePasswordField/typings.d.ts +1 -1
- package/dist/form/fields/PassFailField/PassFailField.d.ts +30 -0
- package/dist/form/fields/PassFailField/PassFailInput.d.ts +7 -0
- package/dist/form/fields/PassFailField/constants.d.ts +7 -0
- package/dist/form/fields/PassFailField/index.d.ts +5 -0
- package/dist/form/fields/PassFailField/typings.d.ts +17 -0
- package/dist/form/fields/PassFailField/utils.d.ts +7 -0
- package/dist/form/fields/RadioField/RadioField.d.ts +2 -2
- package/dist/form/fields/RadioField/RadioInput.d.ts +1 -1
- package/dist/form/fields/RatingField/RatingField.d.ts +32 -0
- package/dist/form/fields/RatingField/RatingInput.d.ts +7 -0
- package/dist/form/fields/RatingField/index.d.ts +3 -0
- package/dist/form/fields/RatingField/typings.d.ts +4 -0
- package/dist/form/fields/ScanField/ScanField.d.ts +2 -2
- package/dist/form/fields/ScanField/ScanInput.d.ts +1 -1
- package/dist/form/fields/SelectField/SelectField.d.ts +2 -2
- package/dist/form/fields/SelectField/SelectInput.d.ts +1 -1
- package/dist/form/fields/StringField/StringField.d.ts +1 -1
- package/dist/form/fields/StringField/StringInput.d.ts +1 -1
- package/dist/form/fields/TextField/TextField.d.ts +1 -1
- package/dist/form/fields/TextField/TextInput.d.ts +1 -1
- package/dist/form/fields/UploadField/UploadField.d.ts +11 -10
- package/dist/form/fields/UploadField/UploadInput.d.ts +1 -1
- package/dist/form/fields/UploadField/index.d.ts +0 -1
- package/dist/form/fields/UploadField/utils.d.ts +0 -3
- package/dist/form/fields/components/InputWithLabel.d.ts +1 -1
- package/dist/form/fields/constants.d.ts +7 -3
- package/dist/form/fields/hooks.d.ts +1 -1
- package/dist/form/fields/index.d.ts +2 -0
- package/dist/form/fields/typings.d.ts +14 -16
- package/dist/form/fields/utils.d.ts +7 -2
- package/dist/form/index.d.ts +3 -0
- package/dist/form/modifiers/file.d.ts +3 -2
- package/dist/form/modifiers/index.d.ts +1 -0
- package/dist/form/modifiers/passFailStatus.d.ts +6 -0
- package/dist/form/modifiers/utils.d.ts +1 -1
- package/dist/form/schema/FieldSchema.d.ts +7 -6
- package/dist/form/typings.d.ts +6 -2
- package/dist/form/utils.d.ts +5 -11
- package/dist/forms.js +2185 -742
- package/dist/forms.js.map +1 -0
- package/dist/forms.umd.cjs +2183 -740
- package/dist/forms.umd.cjs.map +1 -0
- package/package.json +37 -51
- package/dist/form/builder/components/FieldWithActions.d.ts +0 -10
- /package/dist/form/{observable → Observable}/Observable.d.ts +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BooleanFieldCondition } from './BooleanFieldCondition';
|
|
2
|
+
import { CheckboxListFieldCondition } from './CheckboxListFieldCondition';
|
|
3
|
+
import { DateFieldCondition } from './DateFieldCondition';
|
|
4
|
+
import { MultiSelectFieldCondition } from './MultiSelectFieldCondition';
|
|
5
|
+
import { MultiStringFieldCondition } from './MultiStringFieldCondition';
|
|
6
|
+
import { NumberFieldCondition } from './NumberFieldCondition';
|
|
7
|
+
import { OTPFieldCondition } from './OTPFieldCondition';
|
|
8
|
+
import { PassFailFieldCondition } from './PassFailFieldCondition';
|
|
9
|
+
import { RadioFieldCondition } from './RadioFieldCondition';
|
|
10
|
+
import { RatingFieldCondition } from './RatingFieldCondition';
|
|
11
|
+
import { ScanFieldCondition } from './ScanFieldCondition';
|
|
12
|
+
import { SelectFieldCondition } from './SelectFieldCondition';
|
|
13
|
+
import { StringFieldCondition } from './StringFieldCondition';
|
|
14
|
+
import { TextFieldCondition } from './TextFieldCondition';
|
|
15
|
+
import { UploadFieldCondition } from './UploadFieldCondition';
|
|
16
|
+
export declare const ConditionTypeToClsMapping: {
|
|
17
|
+
date: typeof DateFieldCondition;
|
|
18
|
+
number: typeof NumberFieldCondition;
|
|
19
|
+
boolean: typeof BooleanFieldCondition;
|
|
20
|
+
select: typeof SelectFieldCondition;
|
|
21
|
+
string: typeof StringFieldCondition;
|
|
22
|
+
text: typeof TextFieldCondition;
|
|
23
|
+
upload: typeof UploadFieldCondition;
|
|
24
|
+
qr: typeof ScanFieldCondition;
|
|
25
|
+
"multi-string": typeof MultiStringFieldCondition;
|
|
26
|
+
"multi-select": typeof MultiSelectFieldCondition;
|
|
27
|
+
radio: typeof RadioFieldCondition;
|
|
28
|
+
"checkbox-list": typeof CheckboxListFieldCondition;
|
|
29
|
+
"pass-fail": typeof PassFailFieldCondition;
|
|
30
|
+
otp: typeof OTPFieldCondition;
|
|
31
|
+
rating: typeof RatingFieldCondition;
|
|
32
|
+
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export * from './BaseCondition';
|
|
2
2
|
export * from './BooleanFieldCondition';
|
|
3
3
|
export * from './CheckboxListFieldCondition';
|
|
4
|
+
export * from './ConditionManager';
|
|
4
5
|
export * from './DateFieldCondition';
|
|
5
6
|
export * from './MultiSelectFieldCondition';
|
|
6
7
|
export * from './MultiStringFieldCondition';
|
|
7
8
|
export * from './NumberFieldCondition';
|
|
8
9
|
export * from './OTPFieldCondition';
|
|
10
|
+
export * from './PassFailFieldCondition';
|
|
9
11
|
export * from './RadioFieldCondition';
|
|
12
|
+
export * from './RatingFieldCondition';
|
|
10
13
|
export * from './ScanFieldCondition';
|
|
11
14
|
export * from './SelectFieldCondition';
|
|
12
15
|
export * from './StringFieldCondition';
|
|
@@ -6,15 +6,18 @@ import { MultiSelectFieldCondition, SerializedMultiSelectCondition } from './Mul
|
|
|
6
6
|
import { MultiStringFieldCondition, SerializedMultiStringCondition } from './MultiStringFieldCondition';
|
|
7
7
|
import { NumberFieldCondition, SerializedNumberCondition } from './NumberFieldCondition';
|
|
8
8
|
import { OTPFieldCondition, SerializedOTPCondition } from './OTPFieldCondition';
|
|
9
|
+
import { PassFailFieldCondition, SerializedPassFailFieldCondition } from './PassFailFieldCondition';
|
|
9
10
|
import { RadioFieldCondition, SerializedRadioCondition } from './RadioFieldCondition';
|
|
11
|
+
import { RatingFieldCondition, SerializedRatingCondition } from './RatingFieldCondition';
|
|
10
12
|
import { ScanFieldCondition, SerializedScanCondition } from './ScanFieldCondition';
|
|
11
13
|
import { SelectFieldCondition, SerializedSelectCondition } from './SelectFieldCondition';
|
|
12
14
|
import { SerializedStringCondition, StringFieldCondition } from './StringFieldCondition';
|
|
13
15
|
import { SerializedTextCondition, TextFieldCondition } from './TextFieldCondition';
|
|
14
16
|
import { SerializedUploadCondition, UploadFieldCondition } from './UploadFieldCondition';
|
|
15
|
-
export type Condition = BooleanFieldCondition | CheckboxListFieldCondition | DateFieldCondition | MultiSelectFieldCondition | MultiStringFieldCondition | NumberFieldCondition | RadioFieldCondition | ScanFieldCondition | SelectFieldCondition | StringFieldCondition | TextFieldCondition | UploadFieldCondition | OTPFieldCondition;
|
|
16
|
-
export type SerializedCondition = SerializedTextCondition | SerializedBooleanCondition | SerializedNumberCondition | SerializedDateCondition | SerializedStringCondition | SerializedSelectCondition | SerializedMultiStringCondition | SerializedMultiSelectCondition | SerializedUploadCondition | SerializedScanCondition | SerializedRadioCondition | SerializedCheckboxListCondition | SerializedOTPCondition;
|
|
17
|
-
export
|
|
17
|
+
export type Condition = BooleanFieldCondition | CheckboxListFieldCondition | PassFailFieldCondition | DateFieldCondition | MultiSelectFieldCondition | MultiStringFieldCondition | NumberFieldCondition | RadioFieldCondition | RatingFieldCondition | ScanFieldCondition | SelectFieldCondition | StringFieldCondition | TextFieldCondition | UploadFieldCondition | OTPFieldCondition;
|
|
18
|
+
export type SerializedCondition = SerializedTextCondition | SerializedBooleanCondition | SerializedNumberCondition | SerializedDateCondition | SerializedStringCondition | SerializedSelectCondition | SerializedMultiStringCondition | SerializedMultiSelectCondition | SerializedUploadCondition | SerializedScanCondition | SerializedRadioCondition | SerializedRatingCondition | SerializedCheckboxListCondition | SerializedPassFailFieldCondition | SerializedOTPCondition;
|
|
19
|
+
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 OTPFieldCondition;
|
|
20
|
+
export interface FieldConditionManager<TCondition extends AnyCondition> {
|
|
18
21
|
readonly conditions: Record<string, TCondition[]>;
|
|
19
22
|
getConditions(identifier: string): TCondition[];
|
|
20
23
|
addCondition(identifier: string, condition: TCondition): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Field } from '../fields';
|
|
2
1
|
import { FieldValues } from '../typings';
|
|
3
|
-
import { AnyCondition } from './BaseCondition';
|
|
4
2
|
import { Condition, SerializedCondition } from './typings';
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
3
|
+
import { Field } from '../fields';
|
|
4
|
+
export declare const deserializeCondition: (field: Field, serializedCondition: SerializedCondition) => Condition;
|
|
5
|
+
export declare const deserializeConditions: (fields: Field[], serializedConditions: SerializedCondition[]) => Condition[];
|
|
6
|
+
export declare const applyConditions: (conditions: Condition[], values: FieldValues) => boolean;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { BaseFormElement } from '../BaseFormElement';
|
|
2
1
|
import { BaseSerializedField, FieldOptions, FieldValidator } from './typings';
|
|
3
|
-
|
|
2
|
+
import { BaseFormElement } from '../BaseFormElement';
|
|
3
|
+
export declare abstract class BaseField<TType extends string, TValue, TSerializedValue, This extends BaseField<TType, TValue, TSerializedValue, This>> extends BaseFormElement<TType, This> {
|
|
4
4
|
static readonly fieldTypeName: string;
|
|
5
5
|
static readonly fieldTypeDescription: string;
|
|
6
6
|
label: string;
|
|
7
7
|
description: string | null;
|
|
8
8
|
required: boolean;
|
|
9
|
-
private fieldValidators;
|
|
10
9
|
image: File | Promise<File> | undefined;
|
|
11
10
|
/**
|
|
12
11
|
* By default, validation doesn't execute on `onChange` events when editing fields
|
|
@@ -15,11 +14,11 @@ export declare abstract class BaseField<TIdentifier extends string, TValue, TSer
|
|
|
15
14
|
* which don't have a `onBlur` event (which is used to set the `touched` state).
|
|
16
15
|
*/
|
|
17
16
|
readonly onlyValidateAfterTouched: boolean;
|
|
18
|
-
protected constructor(options: FieldOptions
|
|
17
|
+
protected constructor(options: FieldOptions);
|
|
19
18
|
getError(value: TValue): string | undefined;
|
|
20
|
-
serialize(): BaseSerializedField<
|
|
21
|
-
getOptions(): FieldOptions
|
|
22
|
-
setOptions(options: Partial<FieldOptions
|
|
19
|
+
serialize(): BaseSerializedField<TType>;
|
|
20
|
+
getOptions(): FieldOptions;
|
|
21
|
+
setOptions(options: Partial<FieldOptions>): void;
|
|
23
22
|
abstract isSerializedValueValid(value: unknown): value is TSerializedValue;
|
|
24
23
|
abstract serializeValue(value: TValue): TSerializedValue;
|
|
25
24
|
abstract isValueValid(value: unknown): value is TValue;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseFormElementOptions, BaseSerializedFormElement } from '../BaseFormElement';
|
|
2
2
|
import { AnyField } from '../typings';
|
|
3
|
-
export interface BaseSerializedField<
|
|
3
|
+
export interface BaseSerializedField<TType extends string> extends BaseSerializedFormElement<TType> {
|
|
4
4
|
label: string;
|
|
5
5
|
description?: string | null;
|
|
6
6
|
required: boolean;
|
|
7
7
|
image?: File | Promise<File>;
|
|
8
8
|
}
|
|
9
|
-
export interface FieldOptions
|
|
9
|
+
export interface FieldOptions extends BaseFormElementOptions {
|
|
10
10
|
label: string;
|
|
11
11
|
description?: string | null;
|
|
12
12
|
required: boolean;
|
|
13
13
|
image?: File | Promise<File>;
|
|
14
|
-
fieldValidators?: FieldValidator<TValue>[];
|
|
15
14
|
}
|
|
16
15
|
export interface FieldCreationSchemaObject {
|
|
17
16
|
field: AnyField;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare abstract class BaseFormElement<
|
|
5
|
-
abstract readonly type:
|
|
2
|
+
import { BaseFormElementOptions, BaseSerializedFormElement, FieldRenderProps } from './typings';
|
|
3
|
+
import { Observable } from '../../Observable';
|
|
4
|
+
export declare abstract class BaseFormElement<TType extends string, This extends BaseFormElement<TType, This>> extends Observable<This> {
|
|
5
|
+
abstract readonly type: TType;
|
|
6
6
|
identifier: string;
|
|
7
|
-
protected constructor(options:
|
|
8
|
-
getOptions():
|
|
9
|
-
setOptions(options: Partial<
|
|
10
|
-
abstract duplicate(identifier: string): BaseFormElement<
|
|
11
|
-
serialize():
|
|
7
|
+
protected constructor(options: BaseFormElementOptions);
|
|
8
|
+
getOptions(): BaseFormElementOptions;
|
|
9
|
+
setOptions(options: Partial<BaseFormElementOptions>): void;
|
|
10
|
+
abstract duplicate(identifier: string): BaseFormElement<TType, This>;
|
|
11
|
+
serialize(): BaseSerializedFormElement<TType>;
|
|
12
12
|
abstract render(props: FieldRenderProps): ReactNode;
|
|
13
13
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TextSize } from '@overmap-ai/blocks';
|
|
2
|
-
export interface
|
|
2
|
+
export interface BaseFormElementOptions {
|
|
3
3
|
identifier: string;
|
|
4
4
|
}
|
|
5
|
-
export interface
|
|
5
|
+
export interface BaseSerializedFormElement<TType extends string> {
|
|
6
6
|
identifier: string;
|
|
7
|
-
type:
|
|
7
|
+
type: TType;
|
|
8
8
|
}
|
|
9
9
|
export interface FieldRenderProps {
|
|
10
10
|
formId: string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { BaseField, FieldCreationSchemaObject, FieldOptions } from '../BaseField';
|
|
2
1
|
import { BaseSerializedSelectField, SelectFieldOption } from './typings';
|
|
3
|
-
|
|
2
|
+
import { BaseField, FieldCreationSchemaObject, FieldOptions } from '../BaseField';
|
|
3
|
+
export interface BaseOptionsFieldOptions extends FieldOptions {
|
|
4
4
|
options: string[] | SelectFieldOption[];
|
|
5
5
|
}
|
|
6
|
-
export declare abstract class BaseOptionsField<
|
|
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
8
|
readonly onlyValidateAfterTouched = false;
|
|
9
|
-
protected constructor(options: BaseOptionsFieldOptions
|
|
10
|
-
serialize(): BaseSerializedSelectField<
|
|
11
|
-
getOptions(): BaseOptionsFieldOptions
|
|
12
|
-
setOptions(options: Partial<BaseOptionsFieldOptions
|
|
9
|
+
protected constructor(options: BaseOptionsFieldOptions);
|
|
10
|
+
serialize(): BaseSerializedSelectField<TType>;
|
|
11
|
+
getOptions(): BaseOptionsFieldOptions;
|
|
12
|
+
setOptions(options: Partial<BaseOptionsFieldOptions>): void;
|
|
13
13
|
static getFieldCreationSchema(parentPath?: string): FieldCreationSchemaObject[];
|
|
14
14
|
}
|
|
@@ -3,7 +3,7 @@ export interface SelectFieldOption {
|
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
5
|
}
|
|
6
|
-
export interface BaseSerializedSelectField<
|
|
7
|
-
type:
|
|
6
|
+
export interface BaseSerializedSelectField<TType extends string> extends BaseSerializedField<TType> {
|
|
7
|
+
type: TType;
|
|
8
8
|
options: SelectFieldOption[];
|
|
9
9
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { BaseSerializedStringField } from './typings';
|
|
1
2
|
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
2
3
|
import { NumberField } from '../NumberField';
|
|
3
|
-
|
|
4
|
-
export interface BaseStringFieldOptions extends FieldOptions<string> {
|
|
4
|
+
export interface BaseStringFieldOptions extends FieldOptions {
|
|
5
5
|
minLength?: number;
|
|
6
6
|
maxLength?: number;
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare abstract class BaseStringField<
|
|
9
|
+
export declare abstract class BaseStringField<TType extends string, This extends BaseStringField<TType, This>> extends BaseField<TType, string, string, This> {
|
|
10
10
|
minLength?: number;
|
|
11
11
|
maxLength: number;
|
|
12
12
|
placeholder?: string;
|
|
@@ -16,7 +16,7 @@ export declare abstract class BaseStringField<TIdentifier extends string, This e
|
|
|
16
16
|
showDirectly: boolean;
|
|
17
17
|
}[];
|
|
18
18
|
getFieldValidators(): FieldValidator<string>[];
|
|
19
|
-
serialize(): BaseSerializedStringField<
|
|
19
|
+
serialize(): BaseSerializedStringField<TType>;
|
|
20
20
|
getOptions(): BaseStringFieldOptions;
|
|
21
21
|
setOptions(options: Partial<BaseStringFieldOptions>): void;
|
|
22
22
|
serializeValue(value: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseSerializedField } from '../BaseField';
|
|
2
|
-
export interface BaseSerializedStringField<
|
|
2
|
+
export interface BaseSerializedStringField<TType extends string> extends BaseSerializedField<TType> {
|
|
3
3
|
minimum_length?: number;
|
|
4
4
|
maximum_length: number;
|
|
5
5
|
placeholder?: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { SerializedBooleanField } from './typings';
|
|
2
3
|
import { BaseField, FieldOptions } from '../BaseField';
|
|
3
4
|
import { FieldRenderProps } from '../BaseFormElement';
|
|
4
|
-
|
|
5
|
-
import { SerializedBooleanField } from './typings';
|
|
6
|
-
export type BooleanFieldOptions = FieldOptions<boolean>;
|
|
5
|
+
export type BooleanFieldOptions = FieldOptions;
|
|
7
6
|
export declare class BooleanField extends BaseField<"boolean", boolean, boolean, BooleanField> {
|
|
8
7
|
readonly type = "boolean";
|
|
9
8
|
static readonly fieldTypeName = "Checkbox";
|
|
@@ -14,7 +13,7 @@ export declare class BooleanField extends BaseField<"boolean", boolean, boolean,
|
|
|
14
13
|
getOptions(): BooleanFieldOptions;
|
|
15
14
|
setOptions(options: Partial<BooleanFieldOptions>): void;
|
|
16
15
|
duplicate(identifier: string): BooleanField;
|
|
17
|
-
static deserialize(data:
|
|
16
|
+
static deserialize(data: SerializedBooleanField): BooleanField;
|
|
18
17
|
serializeValue(value: boolean): boolean;
|
|
19
18
|
deserializeValue(value: boolean): boolean;
|
|
20
19
|
render(props: FieldRenderProps): ReactNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { SerializedCheckboxListField } from './typings';
|
|
2
3
|
import { FieldRenderProps } from '../BaseFormElement';
|
|
3
4
|
import { BaseOptionsField, BaseOptionsFieldOptions } from '../BaseOptionsField';
|
|
4
|
-
|
|
5
|
-
export interface CheckboxListFieldOptions extends BaseOptionsFieldOptions<string[]> {
|
|
5
|
+
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";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { SerializedDateField } from './typings';
|
|
2
3
|
import { BaseField, FieldOptions } from '../BaseField';
|
|
3
4
|
import { FieldRenderProps } from '../BaseFormElement';
|
|
4
|
-
import { SerializedDateField } from './typings';
|
|
5
5
|
export type SerializedDateRange = {
|
|
6
6
|
to: string | null;
|
|
7
7
|
from: string | null;
|
|
8
8
|
};
|
|
9
|
-
export interface DateFieldOptions extends FieldOptions
|
|
9
|
+
export interface DateFieldOptions extends FieldOptions {
|
|
10
10
|
}
|
|
11
11
|
export declare class DateField extends BaseField<"date", Date | null, string | null, DateField> {
|
|
12
12
|
readonly type = "date";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Condition, ConditionManager } from '../../conditions';
|
|
3
2
|
import { FieldValues } from '../../typings';
|
|
4
|
-
import { BaseFormElement, FieldRenderProps, FormElementOptions } from '../BaseFormElement';
|
|
5
3
|
import { Field, FieldsManager } from '../typings';
|
|
4
|
+
import { Condition, FieldConditionManager } from '../../conditions';
|
|
5
|
+
import { BaseFormElement, BaseFormElementOptions, FieldRenderProps } from '../BaseFormElement';
|
|
6
6
|
import { FieldSectionConditions, SerializedFieldSection } from './typings';
|
|
7
|
-
export interface FieldSectionOptions extends
|
|
7
|
+
export interface FieldSectionOptions extends BaseFormElementOptions {
|
|
8
8
|
label?: string | null;
|
|
9
9
|
description?: string | null;
|
|
10
10
|
conditions?: FieldSectionConditions;
|
|
11
11
|
fields: Field[];
|
|
12
12
|
}
|
|
13
|
-
export declare class FieldSection extends BaseFormElement<"section", FieldSection> implements
|
|
13
|
+
export declare class FieldSection extends BaseFormElement<"section", FieldSection> implements FieldConditionManager<Condition>, FieldsManager {
|
|
14
14
|
static readonly fieldTypeName = "Section";
|
|
15
15
|
static readonly fieldTypeDescription = "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.";
|
|
16
16
|
readonly type = "section";
|
|
@@ -20,7 +20,7 @@ export declare class FieldSection extends BaseFormElement<"section", FieldSectio
|
|
|
20
20
|
fields: Field[];
|
|
21
21
|
constructor(options: FieldSectionOptions);
|
|
22
22
|
serialize(): SerializedFieldSection;
|
|
23
|
-
static deserialize(data: SerializedFieldSection)
|
|
23
|
+
static deserialize: (data: SerializedFieldSection) => FieldSection;
|
|
24
24
|
getOptions(): FieldSectionOptions;
|
|
25
25
|
duplicate(identifier: string): FieldSection;
|
|
26
26
|
setOptions(options: Partial<FieldSectionOptions>): void;
|
|
@@ -28,11 +28,9 @@ export declare class FieldSection extends BaseFormElement<"section", FieldSectio
|
|
|
28
28
|
private fieldObserver;
|
|
29
29
|
private initFields;
|
|
30
30
|
getFields(): Field[];
|
|
31
|
-
addField(field: Field): void;
|
|
32
|
-
addFields(fields: Field[]): void;
|
|
31
|
+
addField(field: Field, index?: number): void;
|
|
33
32
|
moveField(sourceIndex: number, targetIndex: number): void;
|
|
34
33
|
removeField(field: Field): void;
|
|
35
|
-
removeFields(fields: Field[]): void;
|
|
36
34
|
private conditionObserver;
|
|
37
35
|
private initConditions;
|
|
38
36
|
getConditions(identifier: string): Condition[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Condition, SerializedCondition } from '../../conditions';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseSerializedFormElement } from '../BaseFormElement';
|
|
3
3
|
import { SerializedOnlyField } from '../typings';
|
|
4
4
|
export type FieldSectionConditions = Record<string, Condition[]>;
|
|
5
5
|
export type SerializedFieldSectionConditions = Record<string, SerializedCondition[]>;
|
|
6
|
-
export interface SerializedFieldSection extends
|
|
6
|
+
export interface SerializedFieldSection extends BaseSerializedFormElement<"section"> {
|
|
7
7
|
label: string | null;
|
|
8
8
|
description?: string | null;
|
|
9
9
|
conditions: SerializedFieldSectionConditions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { SerializedMultiSelectField } from './typings';
|
|
2
3
|
import { FieldRenderProps } from '../BaseFormElement';
|
|
3
4
|
import { BaseOptionsField, BaseOptionsFieldOptions } from '../BaseOptionsField';
|
|
4
|
-
|
|
5
|
-
export type MultiSelectFieldOptions = BaseOptionsFieldOptions<string[]> & {
|
|
5
|
+
export type MultiSelectFieldOptions = BaseOptionsFieldOptions & {
|
|
6
6
|
placeholder?: string;
|
|
7
7
|
};
|
|
8
8
|
export declare class MultiSelectField extends BaseOptionsField<"multi-select", string[], string[], MultiSelectField> {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { SerializedMultiStringField } from './typings';
|
|
2
3
|
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
3
4
|
import { FieldRenderProps } from '../BaseFormElement';
|
|
4
|
-
|
|
5
|
-
export interface MultiStringFieldOptions extends FieldOptions<string[]> {
|
|
5
|
+
export interface MultiStringFieldOptions extends FieldOptions {
|
|
6
6
|
minimum_length?: number;
|
|
7
7
|
maximum_length?: number;
|
|
8
8
|
placeholder?: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { SerializedNumberField } from './typings';
|
|
2
3
|
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
3
4
|
import { FieldRenderProps } from '../BaseFormElement';
|
|
4
5
|
import { BooleanField } from '../BooleanField';
|
|
5
|
-
import { SerializedNumberField } from './typings';
|
|
6
6
|
export type NumberRange = {
|
|
7
7
|
to: number | null;
|
|
8
8
|
from: number | null;
|
|
9
9
|
};
|
|
10
|
-
export interface NumberFieldOptions extends FieldOptions
|
|
10
|
+
export interface NumberFieldOptions extends FieldOptions {
|
|
11
11
|
maximum?: number;
|
|
12
12
|
minimum?: number;
|
|
13
13
|
integers?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { OTPFieldValidationType, SerializedOTPField } from './typings';
|
|
2
3
|
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
3
4
|
import { FieldRenderProps } from '../BaseFormElement';
|
|
4
5
|
import { NumberField } from '../NumberField';
|
|
5
6
|
import { SelectField } from '../SelectField';
|
|
6
|
-
|
|
7
|
-
export interface OTPFieldOptions extends FieldOptions<string> {
|
|
7
|
+
export interface OTPFieldOptions extends FieldOptions {
|
|
8
8
|
length: number;
|
|
9
9
|
validationType: OTPFieldValidationType;
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OneTimePasswordField } from '@overmap-ai/blocks';
|
|
2
1
|
import { ComponentProps } from 'react';
|
|
2
|
+
import { OneTimePasswordField } from '@overmap-ai/blocks';
|
|
3
3
|
import { BaseSerializedField } from '../BaseField';
|
|
4
4
|
export type OTPFieldValidationType = NonNullable<ComponentProps<typeof OneTimePasswordField.Root>["validationType"]>;
|
|
5
5
|
export interface SerializedOTPField extends BaseSerializedField<"otp"> {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { PassFailFieldStatus, PassFailFieldValue, SerializedPassFailField, SerializedPassFailFieldValue } from './typings';
|
|
3
|
+
import { BaseField, FieldCreationSchemaObject, FieldOptions, FieldValidator } from '../BaseField';
|
|
4
|
+
import { FieldRenderProps } from '../BaseFormElement';
|
|
5
|
+
export interface PassFailFieldOptions extends FieldOptions {
|
|
6
|
+
showNotesAndFilesOn: PassFailFieldStatus[];
|
|
7
|
+
}
|
|
8
|
+
export declare class PassFailField extends BaseField<"pass-fail", PassFailFieldValue, SerializedPassFailFieldValue, PassFailField> {
|
|
9
|
+
readonly type = "pass-fail";
|
|
10
|
+
static readonly fieldTypeName = "Pass - Fail";
|
|
11
|
+
static readonly fieldTypeDescription = "Track pass, fail, or N/A outcome.";
|
|
12
|
+
readonly onlyValidateAfterTouched = false;
|
|
13
|
+
showNotesAndFilesOn: PassFailFieldStatus[];
|
|
14
|
+
constructor(options: PassFailFieldOptions);
|
|
15
|
+
static getFieldCreationSchema(parentPath?: string): FieldCreationSchemaObject[];
|
|
16
|
+
serialize(): SerializedPassFailField;
|
|
17
|
+
getOptions(): PassFailFieldOptions;
|
|
18
|
+
duplicate(identifier: string): PassFailField;
|
|
19
|
+
setOptions(options: Partial<PassFailFieldOptions>): void;
|
|
20
|
+
getFieldValidators(): FieldValidator<PassFailFieldValue>[];
|
|
21
|
+
static deserialize(data: SerializedPassFailField): PassFailField;
|
|
22
|
+
serializeValue(value: PassFailFieldValue): SerializedPassFailFieldValue;
|
|
23
|
+
deserializeValue(value: SerializedPassFailFieldValue): PassFailFieldValue;
|
|
24
|
+
render(props: FieldRenderProps): ReactNode;
|
|
25
|
+
isSerializedValueValid(value: unknown): value is SerializedPassFailFieldValue;
|
|
26
|
+
isValueValid(value: unknown): value is PassFailFieldValue;
|
|
27
|
+
areValuesEqual(value1: PassFailFieldValue, value2: PassFailFieldValue): boolean;
|
|
28
|
+
blankValue(): PassFailFieldValue;
|
|
29
|
+
cleanValue(value: PassFailFieldValue): PassFailFieldValue;
|
|
30
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PassFailField } from './PassFailField';
|
|
2
|
+
import { FieldRenderProps } from '../BaseFormElement';
|
|
3
|
+
interface PassFailInputProps extends FieldRenderProps {
|
|
4
|
+
field: PassFailField;
|
|
5
|
+
}
|
|
6
|
+
export declare const PassFailInput: import('react').MemoExoticComponent<(props: PassFailInputProps) => import("react/jsx-runtime").JSX.Element>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IconComponent } from '@overmap-ai/blocks';
|
|
2
|
+
import { PassFailFieldStatus } from './typings';
|
|
3
|
+
export declare const passFailFieldStatusMapping: Record<PassFailFieldStatus, {
|
|
4
|
+
label: string;
|
|
5
|
+
icon: IconComponent;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const passFailFieldStatuses: PassFailFieldStatus[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UUIDPromise } from '../../UUIDPromise';
|
|
2
|
+
import { BaseSerializedField } from '../BaseField';
|
|
3
|
+
import { UUIDFile } from '../../UUIDFile';
|
|
4
|
+
export type PassFailFieldStatus = "pass" | "fail" | "na";
|
|
5
|
+
export interface PassFailFieldValue {
|
|
6
|
+
status: PassFailFieldStatus | null;
|
|
7
|
+
notes: string;
|
|
8
|
+
files: (UUIDPromise<UUIDFile> | UUIDFile)[];
|
|
9
|
+
}
|
|
10
|
+
export interface SerializedPassFailFieldValue {
|
|
11
|
+
status: PassFailFieldStatus | null;
|
|
12
|
+
notes: string;
|
|
13
|
+
files: never[];
|
|
14
|
+
}
|
|
15
|
+
export interface SerializedPassFailField extends BaseSerializedField<"pass-fail"> {
|
|
16
|
+
showNotesAndFilesOn: PassFailFieldStatus[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PassFailFieldStatus, PassFailFieldValue, SerializedPassFailFieldValue } from './typings';
|
|
2
|
+
export declare const isPassFailFieldStatus: (value: unknown) => value is PassFailFieldStatus;
|
|
3
|
+
export declare const isSerializedPassFailFieldValue: (value: unknown) => value is SerializedPassFailFieldValue;
|
|
4
|
+
export declare const isPassFailFieldValue: (value: unknown) => value is PassFailFieldValue;
|
|
5
|
+
export declare const serializePassFailFieldValue: (value: PassFailFieldValue) => SerializedPassFailFieldValue;
|
|
6
|
+
export declare const deserializePassFailFieldValue: (value: SerializedPassFailFieldValue) => PassFailFieldValue;
|
|
7
|
+
export declare const arePassFieldValuesEqual: (value1: PassFailFieldValue, value2: PassFailFieldValue) => boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { SerializedRadioField } from './typings';
|
|
2
3
|
import { FieldRenderProps } from '../BaseFormElement';
|
|
3
4
|
import { BaseOptionsField, BaseOptionsFieldOptions } from '../BaseOptionsField';
|
|
4
|
-
|
|
5
|
-
export interface RadioFieldOptions extends BaseOptionsFieldOptions<string | null> {
|
|
5
|
+
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";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SerializedRatingField } from './typings';
|
|
3
|
+
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
4
|
+
import { FieldRenderProps } from '../BaseFormElement';
|
|
5
|
+
import { NumberField } from '../NumberField';
|
|
6
|
+
export interface RatingFieldOptions extends FieldOptions {
|
|
7
|
+
maxRating: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class RatingField extends BaseField<"rating", number | null, number | null, RatingField> {
|
|
10
|
+
readonly type = "rating";
|
|
11
|
+
static readonly fieldTypeName = "Rating";
|
|
12
|
+
static readonly fieldTypeDescription = "Allows users to select a rating value.";
|
|
13
|
+
maxRating: number;
|
|
14
|
+
constructor(options: RatingFieldOptions);
|
|
15
|
+
static getFieldCreationSchema(parentPath?: string): {
|
|
16
|
+
field: NumberField;
|
|
17
|
+
showDirectly: boolean;
|
|
18
|
+
}[];
|
|
19
|
+
getFieldValidators(): FieldValidator<number | null>[];
|
|
20
|
+
serialize(): SerializedRatingField;
|
|
21
|
+
getOptions(): RatingFieldOptions;
|
|
22
|
+
duplicate(identifier: string): RatingField;
|
|
23
|
+
setOptions(options: Partial<RatingFieldOptions>): void;
|
|
24
|
+
static deserialize(data: SerializedRatingField): RatingField;
|
|
25
|
+
serializeValue(value: number | null): number | null;
|
|
26
|
+
deserializeValue(value: number | null): number | null;
|
|
27
|
+
render(props: FieldRenderProps): ReactNode;
|
|
28
|
+
isSerializedValueValid(value: unknown): value is number;
|
|
29
|
+
isValueValid(value: unknown): value is number | null;
|
|
30
|
+
areValuesEqual(value1: number | null, value2: number | null): boolean;
|
|
31
|
+
blankValue(): number | null;
|
|
32
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RatingField } from './RatingField';
|
|
2
|
+
import { FieldRenderProps } from '../BaseFormElement';
|
|
3
|
+
interface RatingInputProps extends FieldRenderProps {
|
|
4
|
+
field: RatingField;
|
|
5
|
+
}
|
|
6
|
+
export declare const RatingInput: import('react').NamedExoticComponent<RatingInputProps>;
|
|
7
|
+
export {};
|