@overmap-ai/forms 1.0.32-react-flow-david.1 → 1.0.32-react-flow-david-fixes.1
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/builder/Root.d.ts +13 -0
- package/dist/form/builder/{FieldBuilder.d.ts → components/FieldBuilder.d.ts} +3 -3
- package/dist/form/builder/components/FieldDropdownMenu.d.ts +9 -0
- package/dist/form/builder/components/FieldSectionBuilder.d.ts +5 -0
- package/dist/form/builder/components/FieldSectionDropdownMenu.d.ts +9 -0
- package/dist/form/builder/{FieldSectionWithActions.d.ts → components/FieldSectionWithActions.d.ts} +2 -5
- package/dist/form/builder/{FieldWithActions.d.ts → components/FieldWithActions.d.ts} +4 -3
- package/dist/form/builder/components/index.d.ts +6 -0
- package/dist/form/builder/constants.d.ts +3 -18
- package/dist/form/builder/context.d.ts +1 -1
- package/dist/form/builder/flow/FieldSectionConditionEdge.d.ts +3 -0
- package/dist/form/builder/flow/FieldSectionNode.d.ts +3 -0
- package/dist/form/builder/flow/FlowBuilder.d.ts +1 -0
- package/dist/form/builder/flow/constants.d.ts +3 -0
- package/dist/form/builder/flow/index.d.ts +2 -0
- package/dist/form/builder/flow/layout.d.ts +2 -0
- package/dist/form/builder/flow/typings.d.ts +14 -0
- package/dist/form/builder/hooks.d.ts +3 -3
- package/dist/form/builder/index.d.ts +8 -1
- package/dist/form/builder/list/FieldSectionConditionalItem.d.ts +7 -0
- package/dist/form/builder/list/ListBuilder.d.ts +1 -0
- package/dist/form/builder/list/index.d.ts +1 -0
- package/dist/form/builder/preview/Preview.d.ts +4 -0
- package/dist/form/builder/preview/index.d.ts +1 -0
- package/dist/form/builder/utils.d.ts +4 -25
- package/dist/form/conditions/BaseCondition/BaseCondition.d.ts +29 -0
- package/dist/form/conditions/BaseCondition/index.d.ts +2 -0
- package/dist/form/conditions/BaseCondition/typings.d.ts +18 -0
- package/dist/form/conditions/BooleanFieldCondition/BooleanFieldCondition.d.ts +17 -0
- package/dist/form/conditions/BooleanFieldCondition/BooleanFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/BooleanFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/BooleanFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/CheckboxListFieldCondition/CheckboxListFieldCondition.d.ts +20 -0
- package/dist/form/conditions/CheckboxListFieldCondition/CheckboxListFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/CheckboxListFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/CheckboxListFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/DateFieldCondition/DateFieldCondition.d.ts +22 -0
- package/dist/form/conditions/DateFieldCondition/DateFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/DateFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/DateFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/MultiSelectFieldCondition/MultiSelectFieldCondition.d.ts +28 -0
- package/dist/form/conditions/MultiSelectFieldCondition/MultiSelectFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/MultiSelectFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/MultiSelectFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/MultiStringFieldCondition/MultiStringFieldCondition.d.ts +20 -0
- package/dist/form/conditions/MultiStringFieldCondition/MultiStringFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/MultiStringFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/MultiStringFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/NumberFieldCondition/NumberFieldCondition.d.ts +34 -0
- package/dist/form/conditions/NumberFieldCondition/NumberFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/NumberFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/NumberFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/RadioFieldCondition/RadioFieldCondition.d.ts +19 -0
- package/dist/form/conditions/RadioFieldCondition/RadioFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/RadioFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/RadioFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/ScanFieldCondition/ScanFieldCondition.d.ts +19 -0
- package/dist/form/conditions/ScanFieldCondition/ScanFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/ScanFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/ScanFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/SelectFieldCondition/SelectFieldCondition.d.ts +19 -0
- package/dist/form/conditions/SelectFieldCondition/SelectFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/SelectFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/SelectFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/StringFieldCondition/StringFieldCondition.d.ts +19 -0
- package/dist/form/conditions/StringFieldCondition/StringFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/StringFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/StringFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/TextFieldCondition/TextFieldCondition.d.ts +20 -0
- package/dist/form/conditions/TextFieldCondition/TextFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/TextFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/TextFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/UploadFieldCondition/UploadFieldCondition.d.ts +17 -0
- package/dist/form/conditions/UploadFieldCondition/UploadFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/UploadFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/UploadFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/components/ConditionModifierDropdown.d.ts +4 -8
- package/dist/form/conditions/components/RemoveConditionButton.d.ts +8 -6
- package/dist/form/conditions/components/index.d.ts +7 -0
- package/dist/form/conditions/index.d.ts +15 -1
- package/dist/form/conditions/typings.d.ts +25 -13
- package/dist/form/conditions/utils.d.ts +19 -2
- package/dist/form/fields/BaseField/BaseField.d.ts +17 -48
- package/dist/form/fields/BaseField/hooks.d.ts +21 -17
- package/dist/form/fields/BaseField/typings.d.ts +9 -17
- package/dist/form/fields/BaseFormElement/BaseFormElement.d.ts +14 -0
- package/dist/form/fields/BaseFormElement/index.d.ts +2 -0
- package/dist/form/fields/BaseFormElement/typings.d.ts +9 -0
- package/dist/form/fields/BaseOptionsField/BaseOptionsField.d.ts +18 -0
- package/dist/form/fields/BaseOptionsField/index.d.ts +2 -0
- package/dist/form/fields/BaseOptionsField/typings.d.ts +9 -0
- package/dist/form/fields/BaseStringField/BaseStringField.d.ts +25 -0
- package/dist/form/fields/BaseStringField/index.d.ts +2 -0
- package/dist/form/fields/{StringOrTextField → BaseStringField}/typings.d.ts +1 -1
- package/dist/form/fields/BooleanField/BooleanField.d.ts +15 -23
- package/dist/form/fields/BooleanField/BooleanInput.d.ts +5 -1
- package/dist/form/fields/BooleanField/typings.d.ts +1 -2
- package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +12 -33
- package/dist/form/fields/CheckboxListField/CheckboxListInput.d.ts +5 -1
- package/dist/form/fields/CheckboxListField/typings.d.ts +2 -3
- package/dist/form/fields/DateField/DateField.d.ts +19 -23
- package/dist/form/fields/DateField/DateInput.d.ts +5 -1
- package/dist/form/fields/DateField/typings.d.ts +1 -2
- package/dist/form/fields/FieldSection/FieldSection.d.ts +38 -21
- package/dist/form/fields/FieldSection/FieldSectionLayout.d.ts +5 -4
- package/dist/form/fields/FieldSection/typings.d.ts +9 -7
- package/dist/form/fields/MultiSelectField/MultiSelectField.d.ts +15 -29
- package/dist/form/fields/MultiSelectField/MultiSelectInput.d.ts +4 -1
- package/dist/form/fields/MultiSelectField/typings.d.ts +2 -5
- package/dist/form/fields/MultiStringField/MultiStringField.d.ts +18 -38
- package/dist/form/fields/MultiStringField/MultiStringInput.d.ts +5 -5
- package/dist/form/fields/MultiStringField/typings.d.ts +5 -3
- package/dist/form/fields/NumberField/NumberField.d.ts +20 -34
- package/dist/form/fields/NumberField/NumberInput.d.ts +5 -1
- package/dist/form/fields/NumberField/typings.d.ts +1 -2
- package/dist/form/fields/RadioField/RadioField.d.ts +13 -33
- package/dist/form/fields/RadioField/RadioInput.d.ts +5 -1
- package/dist/form/fields/RadioField/typings.d.ts +2 -3
- package/dist/form/fields/ScanField/ScanField.d.ts +14 -23
- package/dist/form/fields/ScanField/ScanInput.d.ts +4 -1
- package/dist/form/fields/ScanField/typings.d.ts +1 -2
- package/dist/form/fields/SelectField/SelectField.d.ts +14 -27
- package/dist/form/fields/SelectField/SelectInput.d.ts +5 -1
- package/dist/form/fields/SelectField/typings.d.ts +2 -5
- package/dist/form/fields/StringField/StringField.d.ts +11 -21
- package/dist/form/fields/StringField/StringInput.d.ts +5 -1
- package/dist/form/fields/StringField/typings.d.ts +2 -6
- package/dist/form/fields/TextField/TextField.d.ts +10 -17
- package/dist/form/fields/TextField/TextInput.d.ts +5 -1
- package/dist/form/fields/TextField/typings.d.ts +2 -3
- package/dist/form/fields/UploadField/UploadField.d.ts +17 -29
- package/dist/form/fields/UploadField/UploadInput.d.ts +5 -1
- package/dist/form/fields/UploadField/typings.d.ts +1 -2
- package/dist/form/fields/constants.d.ts +3 -91
- package/dist/form/fields/hooks.d.ts +4 -4
- package/dist/form/fields/index.d.ts +4 -3
- package/dist/form/fields/typings.d.ts +36 -30
- package/dist/form/fields/utils.d.ts +10 -15
- package/dist/form/index.d.ts +1 -1
- package/dist/form/{conditions/modifiers → modifiers}/boolean.d.ts +1 -1
- package/dist/form/{conditions/modifier → modifiers}/conditionModifier.d.ts +3 -3
- package/dist/form/modifiers/date.d.ts +9 -0
- package/dist/form/{conditions/modifiers → modifiers}/file.d.ts +1 -1
- package/dist/form/{conditions/modifiers → modifiers}/index.d.ts +3 -0
- package/dist/form/{conditions/modifiers → modifiers}/number.d.ts +4 -1
- package/dist/form/{conditions/modifiers → modifiers}/string.d.ts +1 -1
- package/dist/form/modifiers/typings.d.ts +11 -0
- package/dist/form/modifiers/utils.d.ts +2 -0
- package/dist/form/observable/Observable.d.ts +5 -0
- package/dist/form/renderer/{FormRenderer/FormRenderer.d.ts → FormRenderer.d.ts} +4 -4
- package/dist/form/renderer/constants.d.ts +2 -0
- package/dist/form/renderer/context.d.ts +2 -7
- package/dist/form/renderer/index.d.ts +1 -2
- package/dist/form/schema/FieldSchema.d.ts +16 -0
- package/dist/form/schema/context.d.ts +2 -0
- package/dist/form/schema/index.d.ts +1 -0
- package/dist/form/typings.d.ts +6 -19
- package/dist/form/utils.d.ts +5 -5
- package/dist/forms.js +25675 -16112
- package/dist/forms.umd.cjs +35993 -62
- package/package.json +7 -5
- package/dist/form/builder/DropDispatch.d.ts +0 -27
- package/dist/form/builder/FieldActions.d.ts +0 -13
- package/dist/form/builder/FieldSectionBuilder.d.ts +0 -9
- package/dist/form/builder/FieldSectionConditionEdge.d.ts +0 -4
- package/dist/form/builder/FieldSectionConditionMenu.d.ts +0 -10
- package/dist/form/builder/FieldSectionConditionalItem.d.ts +0 -11
- package/dist/form/builder/FieldSectionNode.d.ts +0 -16
- package/dist/form/builder/FieldsEditor.d.ts +0 -1
- package/dist/form/builder/FormBuilder.d.ts +0 -26
- package/dist/form/builder/flow/CustomNode.d.ts +0 -1
- package/dist/form/builder/flow/FlowEditor.d.ts +0 -1
- package/dist/form/builder/flow/NodeSectionEditor.d.ts +0 -5
- package/dist/form/builder/flow/SectionSidePanel.d.ts +0 -5
- package/dist/form/conditions/components/BooleanFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/CheckboxListFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/DateFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/MultiSelectFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/MultiStringFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/NumberFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/RadioFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/ScanFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/SelectFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/StringFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/TextFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/components/UploadFieldConditionCell.d.ts +0 -5
- package/dist/form/conditions/condition/condition.d.ts +0 -26
- package/dist/form/conditions/condition/index.d.ts +0 -1
- package/dist/form/conditions/condition/typings.d.ts +0 -16
- package/dist/form/conditions/hooks.d.ts +0 -10
- package/dist/form/conditions/manager/conditionManager.d.ts +0 -24
- package/dist/form/conditions/manager/index.d.ts +0 -2
- package/dist/form/conditions/manager/typings.d.ts +0 -1
- package/dist/form/conditions/modifiers/date.d.ts +0 -5
- package/dist/form/fields/BaseSelectField/BaseSelectField.d.ts +0 -35
- package/dist/form/fields/BaseSelectField/index.d.ts +0 -2
- package/dist/form/fields/BaseSelectField/typings.d.ts +0 -5
- package/dist/form/fields/StringOrTextField/StringOrTextField.d.ts +0 -42
- package/dist/form/fields/StringOrTextField/index.d.ts +0 -2
- package/dist/form/renderer/FormRenderer/constants.d.ts +0 -2
- package/dist/form/renderer/PatchForm/Field.d.ts +0 -17
- package/dist/form/renderer/PatchForm/Provider.d.ts +0 -28
- package/dist/form/renderer/PatchForm/index.d.ts +0 -2
- package/dist/forms.css +0 -1
- /package/dist/form/builder/{FieldSettingsPopover.d.ts → components/FieldSettingsPopover.d.ts} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './BaseField';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './BaseFormElement';
|
|
3
|
+
export * from './BaseOptionsField';
|
|
4
|
+
export * from './BaseStringField';
|
|
3
5
|
export * from './BooleanField';
|
|
4
6
|
export * from './CheckboxListField';
|
|
5
7
|
export * from './components';
|
|
@@ -14,8 +16,7 @@ export * from './RadioField';
|
|
|
14
16
|
export * from './ScanField';
|
|
15
17
|
export * from './SelectField';
|
|
16
18
|
export * from './StringField';
|
|
17
|
-
export * from './StringOrTextField';
|
|
18
19
|
export * from './TextField';
|
|
19
|
-
export * from './typings';
|
|
20
|
+
export type * from './typings';
|
|
20
21
|
export * from './UploadField';
|
|
21
22
|
export * from './utils';
|
|
@@ -1,37 +1,43 @@
|
|
|
1
1
|
import { TextSize } from '@overmap-ai/blocks';
|
|
2
2
|
import { HTMLProps } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
export type
|
|
20
|
-
export type
|
|
21
|
-
export type
|
|
22
|
-
export type
|
|
23
|
-
export
|
|
24
|
-
export type InputFieldLevelValidator<TValue> = (value: TValue | undefined) => string | null | undefined;
|
|
25
|
-
export type InputFormLevelValidator<TValue> = (value: TValue | undefined, allValues: FormValues | FormBuilderValues) => string | null | undefined;
|
|
26
|
-
export type InputValidator<TValue> = InputFieldLevelValidator<TValue> | InputFormLevelValidator<TValue>;
|
|
27
|
-
export interface ComponentProps<TField extends BaseFormElement> extends Omit<HTMLProps<HTMLElement>, "color" | "size" | "ref" | "type" | "onChange" | "onBlur" | "value" | "defaultValue" | "name" | "dir"> {
|
|
28
|
-
field: TField;
|
|
3
|
+
import { BaseField } from './BaseField';
|
|
4
|
+
import { AnyFormElement, BaseFormElement } from './BaseFormElement';
|
|
5
|
+
import { BooleanField, SerializedBooleanField } from './BooleanField';
|
|
6
|
+
import { CheckboxListField, SerializedCheckboxListField } from './CheckboxListField';
|
|
7
|
+
import { DateField, SerializedDateField } from './DateField';
|
|
8
|
+
import { FieldSection, SerializedFieldSection } from './FieldSection';
|
|
9
|
+
import { MultiSelectField, SerializedMultiSelectField } from './MultiSelectField';
|
|
10
|
+
import { MultiStringField, SerializedMultiStringField } from './MultiStringField';
|
|
11
|
+
import { NumberField, SerializedNumberField } from './NumberField';
|
|
12
|
+
import { RadioField, SerializedRadioField } from './RadioField';
|
|
13
|
+
import { ScanField, SerializedScanField } from './ScanField';
|
|
14
|
+
import { SelectField, SerializedSelectField } from './SelectField';
|
|
15
|
+
import { SerializedStringField, StringField } from './StringField';
|
|
16
|
+
import { SerializedTextField, TextField } from './TextField';
|
|
17
|
+
import { SerializedUploadField, UploadField } from './UploadField';
|
|
18
|
+
export type AnyField = BaseField<any, any, any, any>;
|
|
19
|
+
export type TypeOfField<TField extends AnyFormElement> = TField extends BaseFormElement<infer TIdentifier, infer _TThis> ? TIdentifier : never;
|
|
20
|
+
export type ValueOfField<TField extends AnyField> = TField extends BaseField<infer _TIdentifier, infer TValue, infer _TSerializedValue, infer _TThis> ? TValue : never;
|
|
21
|
+
export type SerializedValueOfField<TField extends AnyField> = TField extends BaseField<infer _TIdentifier, infer _TValue, infer TSerializedValue, infer _TThis> ? TSerializedValue : never;
|
|
22
|
+
export type FieldValidator<TValue> = (value: TValue | undefined) => string | null | undefined;
|
|
23
|
+
export interface ComponentProps extends Omit<HTMLProps<HTMLElement>, "color" | "size" | "ref" | "type" | "onChange" | "onBlur" | "value" | "defaultValue" | "name" | "dir"> {
|
|
29
24
|
formId: string;
|
|
30
25
|
size?: TextSize;
|
|
31
26
|
onValuesChange?: (identifier: string, value: ValueOfField<AnyField>) => void;
|
|
32
27
|
showInputOnly?: boolean;
|
|
33
28
|
}
|
|
34
|
-
export type
|
|
35
|
-
export type
|
|
36
|
-
export type
|
|
37
|
-
export type
|
|
29
|
+
export type FieldType = TypeOfField<BooleanField> | TypeOfField<CheckboxListField> | TypeOfField<DateField> | TypeOfField<MultiSelectField> | TypeOfField<MultiStringField> | TypeOfField<NumberField> | TypeOfField<RadioField> | TypeOfField<ScanField> | TypeOfField<SelectField> | TypeOfField<StringField> | TypeOfField<TextField> | TypeOfField<UploadField> | TypeOfField<FieldSection>;
|
|
30
|
+
export type FieldValue = ValueOfField<BooleanField> | ValueOfField<CheckboxListField> | ValueOfField<DateField> | ValueOfField<MultiSelectField> | ValueOfField<MultiStringField> | ValueOfField<NumberField> | ValueOfField<RadioField> | ValueOfField<ScanField> | ValueOfField<SelectField> | ValueOfField<StringField> | ValueOfField<TextField> | ValueOfField<UploadField>;
|
|
31
|
+
export type SerializedFieldValue = SerializedValueOfField<BooleanField> | SerializedValueOfField<CheckboxListField> | SerializedValueOfField<DateField> | SerializedValueOfField<MultiSelectField> | SerializedValueOfField<MultiStringField> | SerializedValueOfField<NumberField> | SerializedValueOfField<RadioField> | SerializedValueOfField<ScanField> | SerializedValueOfField<SelectField> | SerializedValueOfField<StringField> | SerializedValueOfField<TextField> | SerializedValueOfField<UploadField>;
|
|
32
|
+
export type Field = BooleanField | CheckboxListField | DateField | MultiSelectField | MultiStringField | NumberField | RadioField | ScanField | SelectField | StringField | TextField | UploadField;
|
|
33
|
+
export type SerializedField = SerializedTextField | SerializedBooleanField | SerializedNumberField | SerializedDateField | SerializedStringField | SerializedSelectField | SerializedFieldSection | SerializedMultiStringField | SerializedMultiSelectField | SerializedUploadField | SerializedScanField | SerializedRadioField | SerializedCheckboxListField;
|
|
34
|
+
export type SerializedOnlyField = Exclude<SerializedField, SerializedFieldSection>;
|
|
35
|
+
export interface FieldsManagerInterface<TField extends AnyFormElement> {
|
|
36
|
+
readonly fields: TField[];
|
|
37
|
+
getFields(): TField[];
|
|
38
|
+
addField(field: TField): void;
|
|
39
|
+
addFields(fields: TField[]): void;
|
|
40
|
+
moveField(sourceIndex: number, targetIndex: number): void;
|
|
41
|
+
removeField(field: TField): void;
|
|
42
|
+
removeFields(fields: TField[]): void;
|
|
43
|
+
}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SerializedFieldValues } from '../typings';
|
|
2
2
|
import { FieldSection } from './FieldSection';
|
|
3
|
-
import { AnyField, FieldValue,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare
|
|
8
|
-
|
|
9
|
-
export declare
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function flattenFields(fields: BaseFormElement[]): AnyField[];
|
|
13
|
-
export declare function getFieldsMapping(fields: BaseFormElement[]): Record<string, AnyField>;
|
|
14
|
-
export declare function decodeFieldValues(fields: BaseFormElement[], values: Record<string, string>): Record<string, FieldValue>;
|
|
15
|
-
export declare function encodeFieldValues(fields: BaseFormElement[], values: Record<string, FieldValue>): Record<string, string>;
|
|
16
|
-
export declare function valueIsFile(v: FieldValue | Promise<File>[] | undefined): v is File[] | Promise<File>[];
|
|
3
|
+
import { AnyField, Field, FieldValue, SerializedField, SerializedFieldValue, SerializedOnlyField } from './typings';
|
|
4
|
+
export declare const deserializeField: (serializedField: SerializedOnlyField) => Field;
|
|
5
|
+
export declare const deserialize: (serialized: SerializedField) => Field | FieldSection;
|
|
6
|
+
export declare function deserializeFields(fields: SerializedField[]): (Field | FieldSection)[];
|
|
7
|
+
export declare function deserializeOnlyFields(fields: SerializedOnlyField[]): Field[];
|
|
8
|
+
export declare function flattenFields(fields: (Field | FieldSection)[]): Field[];
|
|
9
|
+
export declare function getFieldsMapping(fields: (Field | FieldSection)[]): Record<string, Field>;
|
|
10
|
+
export declare function serializeFieldValues(fields: AnyField[], values: SerializedFieldValues): Record<string, SerializedFieldValue>;
|
|
11
|
+
export declare function deserializeFieldValues(fields: AnyField[], values: SerializedFieldValues): Record<string, FieldValue>;
|
package/dist/form/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ConditionModifier } from '
|
|
1
|
+
import { ConditionModifier } from './conditionModifier';
|
|
2
2
|
export declare const BooleanEqualsConditionModifier: ConditionModifier<boolean, boolean, boolean>;
|
|
3
3
|
export declare const BooleanNotEqualsConditionModifier: ConditionModifier<boolean, boolean, boolean>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ConditionModifierFn
|
|
1
|
+
import { ConditionModifierFn } from './typings';
|
|
2
2
|
export interface ConditionModifierConfig<TModifierValue, TModifierConditionValue, TSerializedModifierConditionValue = TModifierConditionValue> {
|
|
3
3
|
id: string;
|
|
4
|
+
label: string;
|
|
4
5
|
modifierFn: ConditionModifierFn<TModifierValue, TModifierConditionValue>;
|
|
5
|
-
render: ConditionModifierRenderFn<TModifierConditionValue>;
|
|
6
6
|
serialize: (conditionValue: TModifierConditionValue) => TSerializedModifierConditionValue;
|
|
7
7
|
deserialize: (serializedConditionValue: TSerializedModifierConditionValue) => TModifierConditionValue | undefined;
|
|
8
8
|
}
|
|
9
9
|
export declare class ConditionModifier<TModifierValue, TConditionValue, TSerializedConditionValue = TConditionValue> {
|
|
10
10
|
readonly id: string;
|
|
11
|
+
readonly label: string;
|
|
11
12
|
readonly modifierFn: ConditionModifierFn<TModifierValue, TConditionValue>;
|
|
12
|
-
readonly render: ConditionModifierRenderFn<TConditionValue>;
|
|
13
13
|
readonly serialize: (conditionValue: TConditionValue) => TSerializedConditionValue;
|
|
14
14
|
readonly deserialize: (serializedConditionValue: TSerializedConditionValue) => TConditionValue | undefined;
|
|
15
15
|
private constructor();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DateRange } from 'react-day-picker';
|
|
2
|
+
import { SerializedDateRange } from '../fields';
|
|
3
|
+
import { ConditionModifier } from './conditionModifier';
|
|
4
|
+
export declare const DateEqualsConditionModifier: ConditionModifier<Date, Date, string>;
|
|
5
|
+
export declare const DateNotEqualsConditionModifier: ConditionModifier<Date, Date, string>;
|
|
6
|
+
export declare const DateBeforeConditionModifier: ConditionModifier<Date, Date, string>;
|
|
7
|
+
export declare const DateAfterConditionModifier: ConditionModifier<Date, Date, string>;
|
|
8
|
+
export declare const DateRangeInConditionModifier: ConditionModifier<Date, DateRange, SerializedDateRange>;
|
|
9
|
+
export declare const DateRangeNotInConditionModifier: ConditionModifier<Date, DateRange, SerializedDateRange>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ConditionModifier } from '
|
|
1
|
+
import { ConditionModifier } from './conditionModifier';
|
|
2
2
|
export declare const HasFilesConditionModifier: ConditionModifier<File[], boolean, boolean>;
|
|
3
3
|
export declare const DoesNotHaveFilesConditionModifier: ConditionModifier<File[], boolean, boolean>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NumberRange } from '../fields';
|
|
2
|
+
import { ConditionModifier } from './conditionModifier';
|
|
2
3
|
export declare const NumberEqualsConditionModifier: ConditionModifier<number, number, number>;
|
|
3
4
|
export declare const NumberNotEqualsConditionModifier: ConditionModifier<number, number, number>;
|
|
4
5
|
export declare const NumberLessThanConditionModifier: ConditionModifier<number, number, number>;
|
|
5
6
|
export declare const NumberLessThanOrEqualsConditionModifier: ConditionModifier<number, number, number>;
|
|
6
7
|
export declare const NumberGreaterThanConditionModifier: ConditionModifier<number, number, number>;
|
|
7
8
|
export declare const NumberGreaterThanOrEqualsConditionModifier: ConditionModifier<number, number, number>;
|
|
9
|
+
export declare const NumberRangeInConditionModifier: ConditionModifier<number, NumberRange, NumberRange>;
|
|
10
|
+
export declare const NumberRangeNotInConditionModifier: ConditionModifier<number, NumberRange, NumberRange>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConditionModifier } from '
|
|
1
|
+
import { ConditionModifier } from './conditionModifier';
|
|
2
2
|
export declare const StringEqualsConditionModifier: ConditionModifier<string, string, string>;
|
|
3
3
|
export declare const StringNotEqualsConditionModifier: ConditionModifier<string, string, string>;
|
|
4
4
|
export declare const StringIncludesConditionModifier: ConditionModifier<string, string, string>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConditionModifier } from './conditionModifier';
|
|
2
|
+
export type ConditionModifierFn<TValue, TConditionValue> = (value: TValue, conditionValue: TConditionValue) => boolean;
|
|
3
|
+
export interface FieldConditionModifierConfig<TValue, TConditionValue, TSerializedConditionValue, TModifierValue extends TValue, TModifierConditionValue extends TConditionValue, TSerializedModifierConditionValue extends TSerializedConditionValue> {
|
|
4
|
+
modifier: ConditionModifier<TModifierValue, TModifierConditionValue, TSerializedModifierConditionValue>;
|
|
5
|
+
isValueValid: (value: TValue) => value is TModifierValue;
|
|
6
|
+
isConditionValueValid: (conditionValue: TConditionValue) => conditionValue is TModifierConditionValue;
|
|
7
|
+
isSerializedValueValid: (serializedConditionValue: TSerializedConditionValue) => serializedConditionValue is TSerializedModifierConditionValue;
|
|
8
|
+
}
|
|
9
|
+
export type AnyConditionModifierConfig<TValue, TConditionValue, TSerializedConditionValue> = FieldConditionModifierConfig<TValue, TConditionValue, TSerializedConditionValue, any, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
10
|
+
any, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
11
|
+
any>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { FieldConditionModifierConfig } from './typings';
|
|
2
|
+
export declare const createConditionModifierConfig: <TFieldValue, TFieldConditionValue, TSerializedFieldConditionValue, TModifierValue extends TFieldValue, TModifierConditionalValue extends TFieldConditionValue, TSerializedModifierConditionValue extends TSerializedFieldConditionValue>(conifg: FieldConditionModifierConfig<TFieldValue, TFieldConditionValue, TSerializedFieldConditionValue, TModifierValue, TModifierConditionalValue, TSerializedModifierConditionValue>) => FieldConditionModifierConfig<TFieldValue, TFieldConditionValue, TSerializedFieldConditionValue, TModifierValue, TModifierConditionalValue, TSerializedModifierConditionValue>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ButtonProps } from '@overmap-ai/blocks';
|
|
2
|
-
import {
|
|
2
|
+
import { FieldValues, ISchema } from '../typings';
|
|
3
3
|
interface FormRendererProps {
|
|
4
4
|
/** The schema of the form the render */
|
|
5
5
|
schema: ISchema;
|
|
6
6
|
/** Initial values of the form */
|
|
7
|
-
values?:
|
|
7
|
+
values?: FieldValues;
|
|
8
8
|
/** The function to call when the form values change */
|
|
9
|
-
onValuesChange?: (allValues:
|
|
9
|
+
onValuesChange?: (allValues: FieldValues, changedValues: FieldValues) => void;
|
|
10
10
|
enableReinitialize?: boolean;
|
|
11
11
|
excludeUnchangedFields?: boolean;
|
|
12
|
-
onSubmit?: (values:
|
|
12
|
+
onSubmit?: (values: FieldValues) => Promise<void> | void;
|
|
13
13
|
/** @default "Submit" */
|
|
14
14
|
submitText?: string;
|
|
15
15
|
/** The text of the cancel button (hidden by default)
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
fields: BaseFormElement[];
|
|
4
|
-
}
|
|
5
|
-
export declare const RendererProvider: import('react').Provider<RendererContextValue | null>;
|
|
6
|
-
export declare const useRendererContext: () => RendererContextValue | null;
|
|
7
|
-
export {};
|
|
1
|
+
import { ISchema } from '../typings';
|
|
2
|
+
export declare const RendererContext: import('react').Context<ISchema>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from './FormRenderer
|
|
2
|
-
export * from './PatchForm';
|
|
1
|
+
export * from './FormRenderer';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FieldSection, FieldsManagerInterface, SerializedFieldSection } from '../fields';
|
|
2
|
+
import { Observable } from '../observable/Observable';
|
|
3
|
+
export declare class FieldSchema extends Observable<FieldSchema> implements FieldsManagerInterface<FieldSection> {
|
|
4
|
+
fields: FieldSection[];
|
|
5
|
+
constructor(fields: FieldSection[]);
|
|
6
|
+
serialize(): SerializedFieldSection[];
|
|
7
|
+
static deserialize(serializedSections: SerializedFieldSection[]): FieldSchema;
|
|
8
|
+
private fieldObserver;
|
|
9
|
+
private initFields;
|
|
10
|
+
addField(field: FieldSection): void;
|
|
11
|
+
addFields(fields: FieldSection[]): void;
|
|
12
|
+
getFields(): FieldSection[];
|
|
13
|
+
removeField(field: FieldSection): void;
|
|
14
|
+
removeFields(fields: FieldSection[]): void;
|
|
15
|
+
moveField(sourceIndex: number, targetIndex: number): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FieldSchema';
|
package/dist/form/typings.d.ts
CHANGED
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* When upload fields are given initial values, that value will be
|
|
5
|
-
* a `Promise<File>[]` instead of a `File[]` as the files must be downloaded.
|
|
6
|
-
* `Promise<File>[]` is not add to the `FieldValue` type as it is not a valid
|
|
7
|
-
* value for submitted form as the files must be present to be submitted
|
|
8
|
-
* TODO: This causes type errors in hemora-web. Maybe we should change this to:
|
|
9
|
-
* export type Form = {
|
|
10
|
-
* data: Record<string, FieldValue>,
|
|
11
|
-
* attachments: Record<string, Promise<File>[]>
|
|
12
|
-
* }
|
|
13
|
-
* Then, we could just use `data` for creating attachment instances.
|
|
14
|
-
*/
|
|
15
|
-
export type FormValues = Record<string, FieldValue | Promise<File>[]>;
|
|
16
|
-
/** All the possible field values */
|
|
1
|
+
import { Field, FieldSection, FieldValue, SerializedFieldValue } from './fields';
|
|
2
|
+
export type FieldValues = Record<string, FieldValue | Promise<File>[] | undefined>;
|
|
3
|
+
export type SerializedFieldValues = Record<string, SerializedFieldValue>;
|
|
17
4
|
export type Severity = "danger" | "warning" | "info" | "success";
|
|
18
5
|
export interface SchemaMeta {
|
|
19
6
|
readonly: boolean;
|
|
20
7
|
}
|
|
21
8
|
export interface ISchema {
|
|
22
9
|
id?: string;
|
|
23
|
-
fields:
|
|
10
|
+
fields: (Field | FieldSection)[];
|
|
24
11
|
meta: SchemaMeta;
|
|
25
|
-
title:
|
|
26
|
-
description?:
|
|
12
|
+
title: string;
|
|
13
|
+
description?: string;
|
|
27
14
|
}
|
package/dist/form/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FormikErrors } from 'formik';
|
|
2
2
|
import { FormBuilderValues } from './builder';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { AnyFormElement } from './fields';
|
|
4
|
+
import { FieldValues } from './typings';
|
|
5
5
|
export declare const hasKeys: (errors: object) => boolean;
|
|
6
|
-
export declare const validateFields: (fields:
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
6
|
+
export declare const validateFields: (fields: AnyFormElement[], values: FieldValues | FormBuilderValues) => FormikErrors<FieldValues | FormBuilderValues> | undefined;
|
|
7
|
+
export declare const initializeFieldValues: (fields: AnyFormElement[], values: FieldValues) => FieldValues;
|
|
8
|
+
export declare const changedFieldValues: (fields: AnyFormElement[], values1: FieldValues, values2: FieldValues) => FieldValues;
|