@overmap-ai/forms 1.0.30 → 1.0.32-react-flow-david.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.
Files changed (85) hide show
  1. package/dist/form/builder/FieldBuilder.d.ts +2 -3
  2. package/dist/form/builder/FieldSectionBuilder.d.ts +9 -0
  3. package/dist/form/builder/FieldSectionConditionEdge.d.ts +4 -0
  4. package/dist/form/builder/FieldSectionConditionMenu.d.ts +10 -0
  5. package/dist/form/builder/FieldSectionConditionalItem.d.ts +11 -0
  6. package/dist/form/builder/FieldSectionNode.d.ts +16 -0
  7. package/dist/form/builder/FieldSectionWithActions.d.ts +2 -3
  8. package/dist/form/builder/FieldWithActions.d.ts +2 -2
  9. package/dist/form/builder/constants.d.ts +0 -1
  10. package/dist/form/builder/flow/CustomNode.d.ts +1 -0
  11. package/dist/form/builder/flow/FlowEditor.d.ts +1 -0
  12. package/dist/form/builder/flow/NodeSectionEditor.d.ts +5 -0
  13. package/dist/form/builder/flow/SectionSidePanel.d.ts +5 -0
  14. package/dist/form/builder/utils.d.ts +1 -0
  15. package/dist/form/conditions/components/BooleanFieldConditionCell.d.ts +5 -0
  16. package/dist/form/conditions/components/CheckboxListFieldConditionCell.d.ts +5 -0
  17. package/dist/form/conditions/components/ConditionModifierDropdown.d.ts +13 -0
  18. package/dist/form/conditions/components/DateFieldConditionCell.d.ts +5 -0
  19. package/dist/form/conditions/components/DayPickerPopover.d.ts +4 -0
  20. package/dist/form/conditions/components/MultiSelectFieldConditionCell.d.ts +5 -0
  21. package/dist/form/conditions/components/MultiStringFieldConditionCell.d.ts +5 -0
  22. package/dist/form/conditions/components/NumberFieldConditionCell.d.ts +5 -0
  23. package/dist/form/conditions/components/RadioFieldConditionCell.d.ts +5 -0
  24. package/dist/form/conditions/components/RemoveConditionButton.d.ts +9 -0
  25. package/dist/form/conditions/components/ScanFieldConditionCell.d.ts +5 -0
  26. package/dist/form/conditions/components/SelectFieldConditionCell.d.ts +5 -0
  27. package/dist/form/conditions/components/SelectFieldOptionMultiSelectGroup.d.ts +6 -0
  28. package/dist/form/conditions/components/SelectFieldOptionSelectGroup.d.ts +6 -0
  29. package/dist/form/conditions/components/StringFieldConditionCell.d.ts +5 -0
  30. package/dist/form/conditions/components/TextFieldConditionCell.d.ts +5 -0
  31. package/dist/form/conditions/components/TextInputPopover.d.ts +9 -0
  32. package/dist/form/conditions/components/UploadFieldConditionCell.d.ts +5 -0
  33. package/dist/form/conditions/components/constants.d.ts +4 -0
  34. package/dist/form/conditions/condition/condition.d.ts +26 -0
  35. package/dist/form/conditions/condition/index.d.ts +1 -0
  36. package/dist/form/conditions/condition/typings.d.ts +16 -0
  37. package/dist/form/conditions/hooks.d.ts +10 -0
  38. package/dist/form/conditions/index.d.ts +1 -0
  39. package/dist/form/conditions/manager/conditionManager.d.ts +24 -0
  40. package/dist/form/conditions/manager/index.d.ts +2 -0
  41. package/dist/form/conditions/manager/typings.d.ts +1 -0
  42. package/dist/form/conditions/modifier/conditionModifier.d.ts +17 -0
  43. package/dist/form/conditions/modifiers/boolean.d.ts +3 -0
  44. package/dist/form/conditions/modifiers/date.d.ts +5 -0
  45. package/dist/form/conditions/modifiers/file.d.ts +3 -0
  46. package/dist/form/conditions/modifiers/index.d.ts +4 -0
  47. package/dist/form/conditions/modifiers/number.d.ts +7 -0
  48. package/dist/form/conditions/modifiers/string.d.ts +12 -0
  49. package/dist/form/conditions/typings.d.ts +14 -0
  50. package/dist/form/conditions/utils.d.ts +2 -0
  51. package/dist/form/fields/BaseField/BaseField.d.ts +14 -2
  52. package/dist/form/fields/BaseField/hooks.d.ts +13 -13
  53. package/dist/form/fields/BaseField/typings.d.ts +8 -1
  54. package/dist/form/fields/BaseSelectField/BaseSelectField.d.ts +1 -1
  55. package/dist/form/fields/BaseSelectField/typings.d.ts +1 -2
  56. package/dist/form/fields/BooleanField/BooleanField.d.ts +9 -2
  57. package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +12 -2
  58. package/dist/form/fields/DateField/DateField.d.ts +13 -4
  59. package/dist/form/fields/FieldSection/FieldSection.d.ts +8 -13
  60. package/dist/form/fields/FieldSection/typings.d.ts +3 -7
  61. package/dist/form/fields/MultiSelectField/MultiSelectField.d.ts +16 -5
  62. package/dist/form/fields/MultiStringField/MultiStringField.d.ts +12 -2
  63. package/dist/form/fields/NumberField/NumberField.d.ts +13 -2
  64. package/dist/form/fields/RadioField/RadioField.d.ts +13 -3
  65. package/dist/form/fields/ScanField/ScanField.d.ts +11 -2
  66. package/dist/form/fields/SelectField/SelectField.d.ts +13 -3
  67. package/dist/form/fields/StringField/StringField.d.ts +2 -0
  68. package/dist/form/fields/StringOrTextField/StringOrTextField.d.ts +9 -1
  69. package/dist/form/fields/TextField/TextField.d.ts +2 -0
  70. package/dist/form/fields/UploadField/UploadField.d.ts +9 -2
  71. package/dist/form/fields/constants.d.ts +0 -8
  72. package/dist/form/fields/hooks.d.ts +3 -3
  73. package/dist/form/fields/typings.d.ts +5 -3
  74. package/dist/form/fields/utils.d.ts +2 -2
  75. package/dist/form/renderer/context.d.ts +7 -0
  76. package/dist/forms.css +1 -0
  77. package/dist/forms.js +8857 -7060
  78. package/dist/forms.umd.cjs +24 -24
  79. package/package.json +5 -3
  80. package/dist/form/fields/CustomField/CustomField.d.ts +0 -23
  81. package/dist/form/fields/CustomField/FieldInputClonerField/FieldInputCloner.d.ts +0 -7
  82. package/dist/form/fields/CustomField/FieldInputClonerField/FieldInputClonerField.d.ts +0 -18
  83. package/dist/form/fields/CustomField/FieldInputClonerField/index.d.ts +0 -3
  84. package/dist/form/fields/CustomField/FieldInputClonerField/typings.d.ts +0 -4
  85. package/dist/form/fields/CustomField/index.d.ts +0 -1
@@ -1,10 +1,9 @@
1
1
  import { FC } from 'react';
2
- import { ISerializedField } from '../fields';
2
+ import { ISerializedOnlyField } from '../fields';
3
3
  import { NestedFieldPath } from './typings';
4
4
  export interface FieldBuilderProps {
5
5
  index: number;
6
6
  parentPath: NestedFieldPath;
7
- initial: ISerializedField;
8
- conditionalSourceFields?: ISerializedField[];
7
+ field: ISerializedOnlyField;
9
8
  }
10
9
  export declare const FieldBuilder: FC<FieldBuilderProps>;
@@ -0,0 +1,9 @@
1
+ import { ISerializedField, SerializedFieldSection } from '../fields';
2
+ import { NestedFieldPath } from './typings';
3
+ export interface FieldSectionBuilderProps {
4
+ index: number;
5
+ parentPath: NestedFieldPath;
6
+ section: SerializedFieldSection;
7
+ conditionalSourceFields?: ISerializedField[];
8
+ }
9
+ export declare const FieldSectionBuilder: import('react').MemoExoticComponent<(props: FieldSectionBuilderProps) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,4 @@
1
+ import { Edge, EdgeProps } from '@xyflow/react';
2
+ export type FieldSectionConditionEdgeData = {};
3
+ export type FieldSectionConditionEdge = Edge<FieldSectionConditionEdgeData, "fieldSectionCondition">;
4
+ export declare const FieldSectionConditionEdgeComponent: import('react').MemoExoticComponent<(props: EdgeProps<FieldSectionConditionEdge>) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,10 @@
1
+ import { MenuRootProps, MenuVariantProps } from '@overmap-ai/blocks';
2
+ import { ReactElement } from 'react';
3
+ import { ConditionManager } from '../conditions/manager';
4
+ import { FieldSection } from '../fields';
5
+ export interface FieldSectionConditionMenuProps extends MenuRootProps, MenuVariantProps {
6
+ children: ReactElement;
7
+ fieldSection: FieldSection;
8
+ conditionManager: ConditionManager;
9
+ }
10
+ export declare const FieldSectionConditionMenu: import('react').NamedExoticComponent<FieldSectionConditionMenuProps>;
@@ -0,0 +1,11 @@
1
+ import { AnySerializedCondition } from '../conditions/condition/typings';
2
+ import { FieldSection } from '../fields';
3
+ import { NestedFieldPath } from './typings';
4
+ interface FieldSectionConditionalItemProps {
5
+ fieldSection: FieldSection;
6
+ fieldSectionIndex: number;
7
+ parentPath: NestedFieldPath;
8
+ serializedConditions: AnySerializedCondition[];
9
+ }
10
+ export declare const FieldSectionConditionalItem: import('react').NamedExoticComponent<FieldSectionConditionalItemProps>;
11
+ export {};
@@ -0,0 +1,16 @@
1
+ import { Node, NodeProps } from '@xyflow/react';
2
+ import { SerializedFieldSection } from '../fields';
3
+ export type FieldSectionNodeData = {
4
+ field: SerializedFieldSection;
5
+ index: number;
6
+ fieldsOnly: boolean;
7
+ };
8
+ export type FieldSectionNode = Node<FieldSectionNodeData, "fieldSection">;
9
+ interface FlowFieldsSectionWithActionsNodeType extends Node<{
10
+ field: SerializedFieldSection;
11
+ index: number;
12
+ fieldsOnly: boolean;
13
+ }> {
14
+ }
15
+ export declare const FieldSectionNodeComponent: import('react').MemoExoticComponent<(props: NodeProps<FlowFieldsSectionWithActionsNodeType>) => import("react/jsx-runtime").JSX.Element>;
16
+ export {};
@@ -1,10 +1,9 @@
1
1
  import { SerializedFieldSection } from '../fields';
2
2
  import { DropState } from './DropDispatch';
3
- interface FieldSectionWithActionsProps {
4
- field: SerializedFieldSection;
3
+ export interface FieldSectionWithActionsProps {
4
+ fieldSection: SerializedFieldSection;
5
5
  index: number;
6
6
  dropState: DropState;
7
7
  fieldsOnly: boolean;
8
8
  }
9
9
  export declare const FieldSectionWithActions: import('react').MemoExoticComponent<(props: FieldSectionWithActionsProps) => import("react/jsx-runtime").JSX.Element>;
10
- export {};
@@ -1,6 +1,6 @@
1
- import { ISerializedField } from '../fields';
1
+ import { ISerializedOnlyField } from '../fields';
2
2
  interface FieldWithActionsProps {
3
- field: ISerializedField;
3
+ field: ISerializedOnlyField;
4
4
  index: number;
5
5
  sectionIndex: number;
6
6
  remove: () => void;
@@ -10,7 +10,6 @@ export declare const CompleteFieldTypeToClsMapping: {
10
10
  select: typeof import('..').SelectField;
11
11
  string: typeof import('..').StringField;
12
12
  text: typeof import('..').TextField;
13
- custom: typeof import('../fields/CustomField').CustomField;
14
13
  upload: typeof import('..').UploadField;
15
14
  qr: typeof import('..').ScanField;
16
15
  "multi-string": typeof import('..').MultiStringField;
@@ -0,0 +1 @@
1
+ export declare const CustomNode: import('react').MemoExoticComponent<(props: any) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1 @@
1
+ export declare const FlowEditor: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,5 @@
1
+ interface NodeSectionEditorProps {
2
+ sectionId: string;
3
+ }
4
+ export declare const NodeSectionEditor: import('react').MemoExoticComponent<(props: NodeSectionEditorProps) => import("react/jsx-runtime").JSX.Element>;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ interface SectionSidePanelProps {
2
+ selectedSectionId?: string;
3
+ }
4
+ export declare const SectionSidePanel: import('react').MemoExoticComponent<(props: SectionSidePanelProps) => import("react/jsx-runtime").JSX.Element>;
5
+ export {};
@@ -18,6 +18,7 @@ export type NewFieldInitialValues = Omit<ISerializedField, "identifier"> & {
18
18
  };
19
19
  export declare const createNewField: (parentPath: NestedFieldPath, index: number, initialValues: NewFieldInitialValues, values: FormBuilderValues, setFieldValue: FormikHelpers<unknown>["setFieldValue"]) => void;
20
20
  export declare const createNewEmptySection: (index: number, values: FormBuilderValues, setFieldValue: FormikHelpers<unknown>["setFieldValue"]) => void;
21
+ export declare const createNewEmptySectionWithId: (index: number, values: FormBuilderValues, setFieldValue: FormikHelpers<unknown>["setFieldValue"], overrides?: Partial<SerializedFieldSection>) => string;
21
22
  export declare const useFieldReordering: () => {
22
23
  reorderSection: (dropState: DropState, sectionId: string, sectionIndex: number, destinationIndex: number, values: FormBuilderValues, setFieldValue: FormikHelpers<unknown>["setFieldValue"]) => void;
23
24
  reorderField: (srcSection: SerializedFieldSection | undefined, srcSectionIndex: string | number | undefined, srcFieldIndex: number, destSection: SerializedFieldSection | undefined, destSectionIndex: string | number | undefined, destFieldIndex: number, setFieldValue: FormikHelpers<unknown>["setFieldValue"]) => void;
@@ -0,0 +1,5 @@
1
+ import { BooleanField, ConditionRenderProps } from '../../fields';
2
+ interface BooleanFieldConditionCellProps extends ConditionRenderProps<BooleanField> {
3
+ }
4
+ export declare const BooleanFieldConditionCell: (props: BooleanFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { CheckboxListField, ConditionRenderProps } from '../../fields';
2
+ interface CheckboxListFieldConditionCellProps extends ConditionRenderProps<CheckboxListField> {
3
+ }
4
+ export declare const CheckboxListFieldConditionCell: (props: CheckboxListFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,13 @@
1
+ import { MenuRootProps, MenuVariantProps } from '@overmap-ai/blocks';
2
+ import { ReactElement } from 'react';
3
+ import { AnyField } from '../../fields';
4
+ import { Condition } from '../condition';
5
+ import { ConditionModifiersOfField } from '../typings';
6
+ interface ConditionModifierDropdownProps<TField extends AnyField> extends MenuVariantProps, MenuRootProps {
7
+ children: ReactElement;
8
+ field: TField;
9
+ condition: Condition<TField>;
10
+ onModifierChange?: (modifierId: ConditionModifiersOfField<TField>) => void;
11
+ }
12
+ export declare const ConditionModifierDropdown: <TFilterDef extends AnyField>(props: ConditionModifierDropdownProps<TFilterDef>) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ConditionRenderProps, DateField } from '../../fields';
2
+ interface DateFieldConditionCellProps extends ConditionRenderProps<DateField> {
3
+ }
4
+ export declare const DateFieldConditionCell: (props: DateFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,4 @@
1
+ import { DayPickerProps, Popover } from '@overmap-ai/blocks';
2
+ import { ComponentPropsWithoutRef } from 'react';
3
+ export type DayPickerPopoverProps = DayPickerProps & ComponentPropsWithoutRef<typeof Popover.Root> & Pick<ComponentPropsWithoutRef<typeof Popover.Content>, "align">;
4
+ export declare const DayPickerPopover: import('react').NamedExoticComponent<DayPickerPopoverProps>;
@@ -0,0 +1,5 @@
1
+ import { ConditionRenderProps, MultiSelectField } from '../../fields';
2
+ interface MultiSelectFieldConditionCellProps extends ConditionRenderProps<MultiSelectField> {
3
+ }
4
+ export declare const MultiSelectFieldConditionCell: (props: MultiSelectFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ConditionRenderProps, MultiStringField } from '../../fields';
2
+ interface MultiStringFieldConditionCellProps extends ConditionRenderProps<MultiStringField> {
3
+ }
4
+ export declare const MultiStringFieldConditionCell: (props: MultiStringFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ConditionRenderProps, NumberField } from '../../fields';
2
+ interface NumberFieldConditionCellProps extends ConditionRenderProps<NumberField> {
3
+ }
4
+ export declare const NumberFieldConditionCell: (props: NumberFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ConditionRenderProps, RadioField } from '../../fields';
2
+ interface RadioFieldConditionCellProps extends ConditionRenderProps<RadioField> {
3
+ }
4
+ export declare const RadioFieldConditionCell: (props: RadioFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ButtonProps } from '@overmap-ai/blocks';
2
+ import { AnyCondition } from '../condition/typings';
3
+ import { ConditionManager } from '../manager';
4
+ interface RemoveConditionButtonProps extends Omit<ButtonProps, "children" | "onClick"> {
5
+ condition: AnyCondition;
6
+ conditionManager: ConditionManager;
7
+ }
8
+ export declare const RemoveConditionButton: import('react').NamedExoticComponent<RemoveConditionButtonProps>;
9
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ConditionRenderProps, ScanField } from '../../fields';
2
+ interface ScanFieldConditionCellProps extends ConditionRenderProps<ScanField> {
3
+ }
4
+ export declare const ScanFieldConditionCell: (props: ScanFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ConditionRenderProps, SelectField } from '../../fields';
2
+ interface SelectFieldConditionCellProps extends ConditionRenderProps<SelectField> {
3
+ }
4
+ export declare const SelectFieldConditionCell: (props: SelectFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ import { MenuMultiSelectGroupProps } from '@overmap-ai/blocks';
2
+ import { SelectFieldOption } from '../../fields';
3
+ export interface SelectFieldOptionMultiSelectGroupProps extends MenuMultiSelectGroupProps<string> {
4
+ selectFieldOptions: SelectFieldOption[];
5
+ }
6
+ export declare const SelectFieldOptionMultiSelectGroup: import('react').NamedExoticComponent<SelectFieldOptionMultiSelectGroupProps>;
@@ -0,0 +1,6 @@
1
+ import { MenuSelectGroupProps } from '@overmap-ai/blocks';
2
+ import { SelectFieldOption } from '../../fields';
3
+ export type SelectFieldOptionSelectGroupProps = MenuSelectGroupProps<string> & {
4
+ selectFieldOptions: SelectFieldOption[];
5
+ };
6
+ export declare const SelectFieldOptionSelectGroup: import('react').NamedExoticComponent<SelectFieldOptionSelectGroupProps>;
@@ -0,0 +1,5 @@
1
+ import { ConditionRenderProps, StringField } from '../../fields';
2
+ interface StringFieldConditionCellProps extends ConditionRenderProps<StringField> {
3
+ }
4
+ export declare const StringFieldConditionCell: (props: StringFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ConditionRenderProps, TextField } from '../../fields';
2
+ interface TextFieldConditionCellProps extends ConditionRenderProps<TextField> {
3
+ }
4
+ export declare const TextFieldConditionCell: (props: TextFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Popover } from '@overmap-ai/blocks';
2
+ import { ComponentPropsWithoutRef } from 'react';
3
+ interface TextInputPopoverProps extends ComponentPropsWithoutRef<typeof Popover.Root>, ComponentPropsWithoutRef<typeof Popover.Content> {
4
+ placeholder?: string;
5
+ value?: string;
6
+ onValueChange?: (value: string) => void;
7
+ }
8
+ export declare const TextInputPopover: import('react').NamedExoticComponent<TextInputPopoverProps>;
9
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ConditionRenderProps, UploadField } from '../../fields';
2
+ interface UploadFieldConditionCellProps extends ConditionRenderProps<UploadField> {
3
+ }
4
+ export declare const UploadFieldConditionCell: (props: UploadFieldConditionCellProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,4 @@
1
+ import { MenuSelectItemProps, SelectAllItemProps } from '@overmap-ai/blocks';
2
+ export declare const SelectItemTemplate: <TValue>(props: MenuSelectItemProps<TValue>) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const MultiSelectItemTemplate: <TValue>(props: MenuSelectItemProps<TValue>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const SelectAllItemTemplate: import('react').NamedExoticComponent<SelectAllItemProps>;
@@ -0,0 +1,26 @@
1
+ import { AnyField, ConditionValueOfField, ValueOfField } from '../../fields';
2
+ import { ConditionManager } from '../manager';
3
+ import { ConditionModifiersOfField } from '../typings';
4
+ import { AnyCondition } from './typings';
5
+ export interface ConditionConfig<TField extends AnyField> {
6
+ id: string;
7
+ conditionValue: ConditionValueOfField<TField> | undefined;
8
+ conditionModifier: ConditionModifiersOfField<TField>;
9
+ field: TField;
10
+ }
11
+ export declare class Condition<TField extends AnyField> {
12
+ readonly id: string;
13
+ private conditionValue;
14
+ private conditionModifier;
15
+ readonly field: TField;
16
+ private subscribers;
17
+ constructor(config: ConditionConfig<TField>);
18
+ subscribe: (callback: (condition: AnyCondition) => void) => () => void;
19
+ private notifySubscribers;
20
+ getConditionValue: () => ConditionValueOfField<TField> | undefined;
21
+ setConditionValue: (filterValue: ConditionValueOfField<TField> | undefined) => void;
22
+ getConditionModifier: () => ConditionModifiersOfField<TField>;
23
+ setConditionModifier: (filterModifier: ConditionModifiersOfField<TField>) => void;
24
+ render: (conditionManager: ConditionManager) => import('react').ReactNode;
25
+ apply: (value: ValueOfField<TField>) => boolean;
26
+ }
@@ -0,0 +1 @@
1
+ export * from './condition';
@@ -0,0 +1,16 @@
1
+ import { AnyField, ConditionValueOfField, SerializedConditionValueOfField } from '../../fields';
2
+ import { ConditionModifiersOfField } from '../typings';
3
+ import { Condition } from './condition';
4
+ export interface SerializedCondition<TField extends AnyField> {
5
+ id: string;
6
+ fieldId: string;
7
+ conditionValue?: SerializedConditionValueOfField<TField>;
8
+ conditionModifier: ConditionModifiersOfField<TField>;
9
+ }
10
+ export type AnySerializedCondition = SerializedCondition<any>;
11
+ export interface CreateConditionConfig<TField extends AnyField> {
12
+ id?: string;
13
+ conditionValue?: ConditionValueOfField<TField>;
14
+ conditionModifier?: ConditionModifiersOfField<TField>;
15
+ }
16
+ export type AnyCondition = Condition<AnyField>;
@@ -0,0 +1,10 @@
1
+ import { FieldSection } from '../fields';
2
+ import { AnyCondition } from './condition/typings';
3
+ import { ConditionManager } from './manager';
4
+ interface useConditionManagerProps {
5
+ section: FieldSection;
6
+ conditions: AnyCondition[];
7
+ onConditionsChange?: (conditions: AnyCondition[]) => void;
8
+ }
9
+ export declare const useConditionManager: (props: useConditionManagerProps) => ConditionManager;
10
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import { FieldSection } from '../../fields';
2
+ import { FormValues } from '../../typings';
3
+ import { AnyCondition } from '../condition/typings';
4
+ export interface ConditionManagerConfig {
5
+ section: FieldSection;
6
+ conditions: AnyCondition[];
7
+ }
8
+ export declare class ConditionManager {
9
+ private section;
10
+ private conditions;
11
+ private onConditionsChange?;
12
+ private constructor();
13
+ static create(config: ConditionManagerConfig): ConditionManager;
14
+ private initConditions;
15
+ private subscribeToCondition;
16
+ getConditions: () => AnyCondition[];
17
+ setConditions: (conditions: AnyCondition[]) => void;
18
+ setOnConditionChange: (onConditionsChange?: (conditions: AnyCondition[]) => void) => void;
19
+ setSection: (section: FieldSection) => void;
20
+ apply: (conditions: AnyCondition[], values: FormValues) => boolean;
21
+ addCondition: (condition: AnyCondition) => void;
22
+ removeCondition: (conditionId: string) => void;
23
+ removeAll: () => void;
24
+ }
@@ -0,0 +1,2 @@
1
+ export * from './conditionManager';
2
+ export type * from './typings';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { ConditionModifierFn, ConditionModifierRenderFn } from '../typings';
2
+ export interface ConditionModifierConfig<TModifierValue, TModifierConditionValue, TSerializedModifierConditionValue = TModifierConditionValue> {
3
+ id: string;
4
+ modifierFn: ConditionModifierFn<TModifierValue, TModifierConditionValue>;
5
+ render: ConditionModifierRenderFn<TModifierConditionValue>;
6
+ serialize: (conditionValue: TModifierConditionValue) => TSerializedModifierConditionValue;
7
+ deserialize: (serializedConditionValue: TSerializedModifierConditionValue) => TModifierConditionValue | undefined;
8
+ }
9
+ export declare class ConditionModifier<TModifierValue, TConditionValue, TSerializedConditionValue = TConditionValue> {
10
+ readonly id: string;
11
+ readonly modifierFn: ConditionModifierFn<TModifierValue, TConditionValue>;
12
+ readonly render: ConditionModifierRenderFn<TConditionValue>;
13
+ readonly serialize: (conditionValue: TConditionValue) => TSerializedConditionValue;
14
+ readonly deserialize: (serializedConditionValue: TSerializedConditionValue) => TConditionValue | undefined;
15
+ private constructor();
16
+ static create<TValue, TConditionValue, TSerializedConditionValue = TConditionValue>(config: ConditionModifierConfig<TValue, TConditionValue, TSerializedConditionValue>): ConditionModifier<TValue, TConditionValue, TSerializedConditionValue>;
17
+ }
@@ -0,0 +1,3 @@
1
+ import { ConditionModifier } from '../modifier/conditionModifier';
2
+ export declare const BooleanEqualsConditionModifier: ConditionModifier<boolean, boolean, boolean>;
3
+ export declare const BooleanNotEqualsConditionModifier: ConditionModifier<boolean, boolean, boolean>;
@@ -0,0 +1,5 @@
1
+ import { ConditionModifier } from '../modifier/conditionModifier';
2
+ export declare const DateEqualsConditionModifier: ConditionModifier<Date, Date, string>;
3
+ export declare const DateNotEqualsConditionModifier: ConditionModifier<Date, Date, string>;
4
+ export declare const DateBeforeConditionModifier: ConditionModifier<Date, Date, string>;
5
+ export declare const DateAfterConditionModifier: ConditionModifier<Date, Date, string>;
@@ -0,0 +1,3 @@
1
+ import { ConditionModifier } from '../modifier/conditionModifier';
2
+ export declare const HasFilesConditionModifier: ConditionModifier<File[], boolean, boolean>;
3
+ export declare const DoesNotHaveFilesConditionModifier: ConditionModifier<File[], boolean, boolean>;
@@ -0,0 +1,4 @@
1
+ export * from './boolean';
2
+ export * from './date';
3
+ export * from './number';
4
+ export * from './string';
@@ -0,0 +1,7 @@
1
+ import { ConditionModifier } from '../modifier/conditionModifier';
2
+ export declare const NumberEqualsConditionModifier: ConditionModifier<number, number, number>;
3
+ export declare const NumberNotEqualsConditionModifier: ConditionModifier<number, number, number>;
4
+ export declare const NumberLessThanConditionModifier: ConditionModifier<number, number, number>;
5
+ export declare const NumberLessThanOrEqualsConditionModifier: ConditionModifier<number, number, number>;
6
+ export declare const NumberGreaterThanConditionModifier: ConditionModifier<number, number, number>;
7
+ export declare const NumberGreaterThanOrEqualsConditionModifier: ConditionModifier<number, number, number>;
@@ -0,0 +1,12 @@
1
+ import { ConditionModifier } from '../modifier/conditionModifier';
2
+ export declare const StringEqualsConditionModifier: ConditionModifier<string, string, string>;
3
+ export declare const StringNotEqualsConditionModifier: ConditionModifier<string, string, string>;
4
+ export declare const StringIncludesConditionModifier: ConditionModifier<string, string, string>;
5
+ export declare const StringExcludesConditionModifier: ConditionModifier<string, string, string>;
6
+ export declare const StringArrayIncludesConditionModifier: ConditionModifier<string, string[], string[]>;
7
+ export declare const StringArrayExcludesConditionModifier: ConditionModifier<string, string[], string[]>;
8
+ export declare const StringArrayEveryConditionModifier: ConditionModifier<string[], string[], string[]>;
9
+ export declare const StringArraySomeConditionModifier: ConditionModifier<string[], string[], string[]>;
10
+ export declare const StringArrayNoneConditionModifier: ConditionModifier<string[], string[], string[]>;
11
+ export declare const StringArrayEqualsConditionModifier: ConditionModifier<string[], string[], string[]>;
12
+ export declare const StringArrayNotEqualsConditionModifier: ConditionModifier<string[], string[], string[]>;
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ import { AnyField, BaseField } from '../fields';
3
+ import { ConditionModifier } from './modifier/conditionModifier';
4
+ export type ConditionModifierRenderFn<TConditionValue> = (conditionValue: TConditionValue) => ReactNode;
5
+ export type ConditionModifierFn<TValue, TConditionValue> = (value: TValue, conditionValue: TConditionValue) => boolean;
6
+ export interface FieldConditionModifierConfig<TFieldValue, TFieldConditionValue, TSerializedFieldConditionValue, TModifierValue extends TFieldValue, TModifierConditionValue extends TFieldConditionValue, TSerializedModifierConditionValue extends TSerializedFieldConditionValue> {
7
+ modifier: ConditionModifier<TModifierValue, TModifierConditionValue, TSerializedModifierConditionValue>;
8
+ isValueValid: (value: TFieldValue) => value is TModifierValue;
9
+ isConditionValueValid: (conditionValue: TFieldConditionValue) => conditionValue is TModifierConditionValue;
10
+ }
11
+ export type AnyConditionModifierConfig<TFieldValue, TFieldConditionValue, TSerializedFieldConditionValue> = FieldConditionModifierConfig<TFieldValue, TFieldConditionValue, TSerializedFieldConditionValue, any, // eslint-disable-line @typescript-eslint/no-explicit-any
12
+ any, // eslint-disable-line @typescript-eslint/no-explicit-any
13
+ any>;
14
+ export type ConditionModifiersOfField<TFilterDef extends AnyField> = TFilterDef extends BaseField<infer _TIdentifier, infer _TValue, infer _TFilterValue, infer _TSerializedFilterValue> ? keyof TFilterDef["modifiers"] : never;
@@ -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,9 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { FormBuilderValues } from '../../builder';
3
+ import { Condition } from '../../conditions/condition';
4
+ import { CreateConditionConfig, SerializedCondition } from '../../conditions/condition/typings';
5
+ import { AnyConditionModifierConfig } from '../../conditions/typings';
3
6
  import { FormValues } from '../../typings';
4
7
  import { FieldSection } from '../FieldSection';
5
8
  import { AnyField, FieldTypeIdentifier, FieldValue, GetInputProps, InputFieldLevelValidator, InputFormLevelValidator, ISerializedField, ISerializedOnlyField } from '../typings';
6
- import { BaseSerializedField, BaseSerializedObject, FieldOptions } from './typings';
9
+ import { BaseSerializedField, BaseSerializedObject, ConditionRenderProps, FieldOptions } from './typings';
7
10
  export declare abstract class BaseFormElement<TIdentifier extends FieldTypeIdentifier = FieldTypeIdentifier> {
8
11
  readonly type: TIdentifier;
9
12
  readonly identifier: string;
@@ -23,7 +26,7 @@ export interface FieldCreationSchemaObject {
23
26
  field: AnyField;
24
27
  showDirectly: boolean;
25
28
  }
26
- export declare abstract class BaseField<TValue extends FieldValue, TIdentifier extends FieldTypeIdentifier = FieldTypeIdentifier> extends BaseFormElement<TIdentifier> {
29
+ export declare abstract class BaseField<TIdentifier extends FieldTypeIdentifier, TValue extends FieldValue, TConditionValue, TSerializedConditionValue = TConditionValue> extends BaseFormElement<TIdentifier> {
27
30
  static readonly fieldTypeName: string;
28
31
  static readonly fieldTypeDescription: string;
29
32
  readonly required: boolean;
@@ -49,4 +52,13 @@ export declare abstract class BaseField<TValue extends FieldValue, TIdentifier e
49
52
  getFormValidators(): InputFormLevelValidator<TValue>[];
50
53
  encodeValueToJson(value: TValue): string;
51
54
  decodeJsonToValue(json: string): TValue;
55
+ abstract readonly defaultConditionValue: TConditionValue | undefined;
56
+ abstract readonly defaultConditionModifier: keyof typeof this.modifiers;
57
+ abstract readonly modifiers: Record<string, AnyConditionModifierConfig<TValue, TConditionValue, TSerializedConditionValue>>;
58
+ abstract renderCondition(props: ConditionRenderProps<BaseField<TIdentifier, TValue, TConditionValue, TSerializedConditionValue>>): ReactNode;
59
+ getConditionModifier: (modifier: keyof typeof this.modifiers) => AnyConditionModifierConfig<TValue, TConditionValue, TSerializedConditionValue>;
60
+ getConditionModifiers: () => [keyof typeof this.modifiers, AnyConditionModifierConfig<TValue, TConditionValue, TSerializedConditionValue>][];
61
+ createCondition(config?: CreateConditionConfig<typeof this>): Condition<typeof this>;
62
+ serializeCondition(condition: Condition<typeof this>): SerializedCondition<typeof this>;
63
+ deserializeCondition(serializedFilter: SerializedCondition<typeof this>): Condition<typeof this>;
52
64
  }
@@ -311,23 +311,13 @@ export declare const useFormikInput: <TField extends AnyField>(props: ComponentP
311
311
  readonly crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
312
312
  readonly href?: string | undefined;
313
313
  readonly default?: boolean | undefined;
314
- readonly open?: boolean | undefined;
315
- readonly loop?: boolean | undefined;
316
- readonly disabled?: boolean | undefined;
317
- readonly formAction?: string | undefined | ((formData: FormData) => void | Promise<void>) | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS];
318
- readonly formEncType?: string | undefined;
319
- readonly formMethod?: string | undefined;
320
- readonly formNoValidate?: boolean | undefined;
321
- readonly formTarget?: string | undefined;
322
- readonly src?: string | undefined;
323
- readonly alt?: string | undefined;
324
- readonly download?: any;
325
- readonly htmlFor?: string | undefined;
314
+ readonly required?: boolean | undefined;
326
315
  readonly accept?: string | undefined;
327
316
  readonly acceptCharset?: string | undefined;
328
317
  readonly action?: string | undefined | ((formData: FormData) => void | Promise<void>) | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS];
329
318
  readonly allowFullScreen?: boolean | undefined;
330
319
  readonly allowTransparency?: boolean | undefined;
320
+ readonly alt?: string | undefined;
331
321
  readonly as?: string | undefined;
332
322
  readonly async?: boolean | undefined;
333
323
  readonly autoComplete?: string | undefined;
@@ -345,16 +335,25 @@ export declare const useFormikInput: <TField extends AnyField>(props: ComponentP
345
335
  readonly coords?: string | undefined;
346
336
  readonly dateTime?: string | undefined;
347
337
  readonly defer?: boolean | undefined;
338
+ readonly disabled?: boolean | undefined;
339
+ readonly download?: any;
348
340
  readonly encType?: string | undefined;
341
+ readonly formAction?: string | undefined | ((formData: FormData) => void | Promise<void>) | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS];
342
+ readonly formEncType?: string | undefined;
343
+ readonly formMethod?: string | undefined;
344
+ readonly formNoValidate?: boolean | undefined;
345
+ readonly formTarget?: string | undefined;
349
346
  readonly frameBorder?: number | string | undefined;
350
347
  readonly headers?: string | undefined;
351
348
  readonly high?: number | undefined;
352
349
  readonly hrefLang?: string | undefined;
350
+ readonly htmlFor?: string | undefined;
353
351
  readonly httpEquiv?: string | undefined;
354
352
  readonly integrity?: string | undefined;
355
353
  readonly keyParams?: string | undefined;
356
354
  readonly keyType?: string | undefined;
357
355
  readonly kind?: string | undefined;
356
+ readonly loop?: boolean | undefined;
358
357
  readonly low?: number | undefined;
359
358
  readonly manifest?: string | undefined;
360
359
  readonly marginHeight?: number | undefined;
@@ -365,13 +364,13 @@ export declare const useFormikInput: <TField extends AnyField>(props: ComponentP
365
364
  readonly multiple?: boolean | undefined;
366
365
  readonly muted?: boolean | undefined;
367
366
  readonly noValidate?: boolean | undefined;
367
+ readonly open?: boolean | undefined;
368
368
  readonly optimum?: number | undefined;
369
369
  readonly placeholder?: string | undefined;
370
370
  readonly playsInline?: boolean | undefined;
371
371
  readonly poster?: string | undefined;
372
372
  readonly preload?: string | undefined;
373
373
  readonly readOnly?: boolean | undefined;
374
- readonly required?: boolean | undefined;
375
374
  readonly reversed?: boolean | undefined;
376
375
  readonly rows?: number | undefined;
377
376
  readonly rowSpan?: number | undefined;
@@ -383,6 +382,7 @@ export declare const useFormikInput: <TField extends AnyField>(props: ComponentP
383
382
  readonly selected?: boolean | undefined;
384
383
  readonly shape?: string | undefined;
385
384
  readonly sizes?: string | undefined;
385
+ readonly src?: string | undefined;
386
386
  readonly srcDoc?: string | undefined;
387
387
  readonly srcLang?: string | undefined;
388
388
  readonly srcSet?: string | undefined;
@@ -1,4 +1,6 @@
1
- import { FieldTypeIdentifier, InputFieldLevelValidator, InputFormLevelValidator } from '../typings';
1
+ import { Condition } from '../../conditions/condition';
2
+ import { ConditionManager } from '../../conditions/manager';
3
+ import { AnyField, FieldTypeIdentifier, InputFieldLevelValidator, InputFormLevelValidator } from '../typings';
2
4
  export interface BaseSerializedObject<TIdentifier extends FieldTypeIdentifier = FieldTypeIdentifier> {
3
5
  description?: string | null;
4
6
  identifier: string;
@@ -14,3 +16,8 @@ export interface FieldOptions<TValue> extends BaseSerializedField {
14
16
  formValidators?: InputFormLevelValidator<TValue>[];
15
17
  }
16
18
  export type ChildFieldOptions<TValue> = Omit<FieldOptions<TValue>, "type">;
19
+ export interface ConditionRenderProps<TField extends AnyField> {
20
+ field: TField;
21
+ condition: Condition<TField>;
22
+ conditionManager: ConditionManager;
23
+ }
@@ -13,7 +13,7 @@ export interface BaseSelectFieldOptions<TValue, TIdentifier extends "select" | "
13
13
  type: TIdentifier;
14
14
  placeholder?: string;
15
15
  }
16
- export declare abstract class BaseSelectField<TValue extends FieldValue, TIdentifier extends "select" | "multi-select"> extends BaseField<TValue, TIdentifier> {
16
+ export declare abstract class BaseSelectField<TIdentifier extends "select" | "multi-select", TValue extends FieldValue, TConditionValue, TSerializedConditionValue = TConditionValue> extends BaseField<TIdentifier, TValue, TConditionValue, TSerializedConditionValue> {
17
17
  readonly options: SelectFieldOption[];
18
18
  readonly onlyValidateAfterTouched = false;
19
19
  readonly placeholder: string;