/** * @typedef ContentFragmentConditionFunction * @callback ContentFragmentConditionFunction * @param {object} props props T of the Component that includes the static prop named Content of type [DynamicContentStore](DynamicContentStore) * @returns {boolean} whether the content fragment should be either added/replaced/removed or not * @memberof DynamicContentStore */ export type ContentFragmentConditionFunction = (props: any) => boolean; /** * Options for removing a component * * @typedef RemoveComponentCallOptions * @property {ContentFragmentConditionFunction} [if] - function that returns whether the component should be removed or not. * @memberof DynamicContentStore */ export interface RemoveComponentCallOptions { if?: ContentFragmentConditionFunction; } /** * Remove component call request * @typedef RemoveComponentCall * @property {React.Key} key that identifies the fragment to remove * @property {DynamicContentStore.RemoveComponentCallOptions} options of the fragment to remove * @memberof DynamicContentStore * @private */ export interface RemoveComponentCall { key: React.Key; options: RemoveComponentCallOptions; } /** * Alignment of the fragment * * @typedef {"start" | "end"} ContentFragmentAlignment * @memberof DynamicContentStore */ export type ContentFragmentAlignment = "start" | "end"; /** * Props of content fragment * * @typedef ContentFragmentProps * @property {ContentFragmentAlignment} [align] - fragment alignment * @property {boolean} [replace] - whether the fragment should replace an existing one or not. Always set to true when calling `replace` method from [DynamicContentStore](DynamicContentStore#replace-child-options-cleanupfunction). * @property {number} [sortOrder] - index in which to position the fragment within the component. * @property {ContentFragmentConditionFunction} [if] - function that returns whether the content fragment should be added or replaced. * @property {boolean} [noChildProps] - whether the fragment should be rendered with props that other siblings was rendered with * @memberof DynamicContentStore */ export interface ContentFragmentProps { align?: ContentFragmentAlignment; replace?: boolean; sortOrder?: number; if?: ContentFragmentConditionFunction; noChildProps?: boolean; } /** * @typedef CleanupFunction * @callback CleanupFunction * @returns {void} * @memberof DynamicContentStore */ export type CleanupFunction = () => void;