Configuration for state transformation and filtering via ContextAwareStateOptions.
A PropertyDecorator that sets up automatic subscription to the current limeobject.
Subscribes to: LimeObjectRepository
Updates: The decorated property with the current LimeObject
Context-aware: Automatically reacts to changes in the component's context.limetype and context.id
Lifecycle: Automatically subscribes in connectedCallback and
unsubscribes in disconnectedCallback of the component.
import { State } from '@stencil/core';
import {
LimeObject,
SelectCurrentLimeObject,
} from '@limetech/lime-web-components';
class MyComponent {
@State()
@SelectCurrentLimeObject()
private currentObject: LimeObject;
}
import { State } from '@stencil/core';
import {
LimeObject,
SelectCurrentLimeObject,
} from '@limetech/lime-web-components';
class MyComponent {
@State()
@SelectCurrentLimeObject({
map: [(limeObject: LimeObject) => limeObject?.getValue('name')],
})
private objectName: string;
}
Decorator that subscribes to the limeobject for the current context from the LimeObjectRepository.
This decorator automatically updates the decorated property whenever the current limeobject changes. It uses the component's context (limetype and id) to determine which object to select. When the context changes, the decorator automatically fetches the new object. It's the recommended approach over manual subscriptions as it handles subscription lifecycle and context changes automatically.