Open Pioneer Trails Packages
    Preparing search index...

    Context object providing access to feature properties and editing state during form editing.

    This class manages the state of a feature being edited, including its properties, validation status, and associated metadata. It provides reactive property management through a ReactiveMap, allowing components to automatically re-render when properties change.

    Access this context in custom forms using the usePropertyFormContext hook.

    interface PropertyFormContext {
        editingStep: ModificationStep;
        feature: Feature;
        getPropertiesAsObject: () => Record<string, unknown>;
        isValid: boolean;
        layer: Layer | undefined;
        mode: Mode;
        properties: ReactiveMap<string, unknown>;
        template: FeatureTemplate | undefined;
    }
    Index

    Properties

    editingStep: ModificationStep

    The current editing step containing the feature and associated metadata.

    Provides access to the complete editing step, which can be either a CreationStep or UpdateStep.

    feature: Feature

    The OpenLayers feature being edited.

    Provides direct access to the feature object, which includes its geometry and properties.

    getPropertiesAsObject: () => Record<string, unknown>

    Returns all feature properties as a plain JavaScript object.

    Converts the reactive properties map to a standard object with string keys and unknown values. Useful when you need to pass properties to functions that expect plain objects.

    Note that a new object is created on every change. Prefer to use fine grained accesses to properties if performance matters.

    Type Declaration

      • (): Record<string, unknown>
      • Returns Record<string, unknown>

        A plain object containing all feature properties (excluding geometry).

    isValid: boolean

    Whether the form is currently valid.

    Controls the enabled state of the save button in the property editor. Set this to true when the form passes validation, or false when there are validation errors. For declarative forms, this is managed automatically based on field validation rules.

    layer: Layer | undefined

    The layer containing the feature being edited, if in update mode.

    Returns the Layer when editing an existing feature (mode === "update"), or undefined when creating a new feature (mode === "create") or if the layer is not available.

    mode: Mode

    The current editing mode.

    Returns "create" when creating a new feature, or "update" when editing an existing feature. Use this to conditionally render different UI or apply different logic based on the editing mode.

    properties: ReactiveMap<string, unknown>

    Reactive map of feature properties.

    Provides reactive access to all feature properties (excluding geometry). Use get() to read property values and set() to update them. Components can use useReactiveSnapshot to automatically re-render when values change.

    const name = context.properties.get("name");
    context.properties.set("name", "New Name");
    template: FeatureTemplate | undefined

    The feature template used to create the feature, if in creation mode.

    Returns the FeatureTemplate when creating a new feature (mode === "create"), or undefined when editing an existing feature (mode === "update").