ngx-dynamic-hooks
Version:
Automatically insert live Angular components into a dynamic string of content (based on their selector or any pattern of your choice) and render the result in the DOM.
79 lines (78 loc) • 3.64 kB
TypeScript
import { Hook, HookIndex, PreviousHookBinding } from '../../interfacesPublic';
import { ParseOptions } from '../../services/settings/options';
import { DeepComparer, DetailedStringifyResult } from '../utils/deepComparer';
import { Logger } from '../utils/logger';
import * as i0 from "@angular/core";
/**
* The service responsible for updating dynamically created components
*/
export declare class ComponentUpdater {
private deepComparer;
private logger;
constructor(deepComparer: DeepComparer, logger: Logger);
/**
* Invoked when the inputs/outputs should be checked for updates
*
* @param hookIndex - The current hookIndex
* @param context - The new context object
* @param options - The current ParseOptions
* @param triggerOnDynamicChanges - Whether to trigger the OnDynamicChanges method of dynamically loaded components
*/
refresh(hookIndex: HookIndex, context: any, options: ParseOptions, triggerOnDynamicChanges: boolean): void;
/**
* Creates or updates bindings for a hook with a loaded component
*
* @param hook - THe hook to update
* @param context - The context object
* @param options - The current ParseOptions
*/
updateBindings(hook: Hook, context: any, options: ParseOptions): void;
/**
* Creates a list of all previous bindings along with their stringified values
*
* @param hook - The hook to check
* @param type - The type of bindings that should be saved
* @param saveStringified - Whether to save the stringified value in addition to the reference
* @param stringifyDepth - How many levels deep to stringify the previous bindings
*/
savePreviousBindings(hook: Hook, type: 'inputs' | 'outputs', saveStringified: boolean, stringifyDepth: number): {
[key: string]: PreviousHookBinding;
};
/**
* Processes a hook object and updates the inputs of a dynamic component where required
*
* @param hook - The hook in question
* @param options - The current ParseOptions
*/
updateComponentWithNewInputs(hook: Hook, options: ParseOptions): void;
/**
* Processes a hook object and (re)subscribes the outputs of a dynamic component where required
*
* @param hook - The hook in question
* @param context - The current context object
* @param options - The current ParseOptions
*/
updateComponentWithNewOutputs(hook: Hook, context: any, options: ParseOptions): void;
/**
* Compares the current with the previous bindings and returns those that have changed
*
* @param hook - The hook in question
* @param type - What kind of binding to check
* @param options - The current ParseOptions
*/
getChangedBindings(hook: Hook, type: 'inputs' | 'outputs', options: ParseOptions): {
[key: string]: any;
};
/**
* Checks whether two detailedStringifiedResults can be compared and throws lots of errors and warnings if not
*
* @param bindingName - The binding in question
* @param componentName - The component in question
* @param options - The current ParseOptions
* @param oldResult - The detailedStringifiedResult for the old value
* @param newResult - The detailedStringifiedResult for the new value
*/
checkDetailedStringifyResultPair(bindingName: string, componentName: string, options: ParseOptions, oldResult: DetailedStringifyResult, newResult: DetailedStringifyResult): boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<ComponentUpdater, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ComponentUpdater>;
}