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.
55 lines (54 loc) • 2.81 kB
TypeScript
import { DataTypeParser } from '../../services/utils/dataTypeParser';
import { SelectorHookParserConfig } from './selectorHookParserConfig';
import { RichBindingData } from '../../interfaces';
import { Logger } from '../../services/utils/logger';
import { ParseOptions } from '../../services/settings/options';
import * as i0 from "@angular/core";
/**
* A helper service for the SelectorHookParsers that evaluates bindings and only updates them when needed so references are retained when possible
*/
export declare class BindingsValueManager {
private dataTypeParser;
private logger;
constructor(dataTypeParser: DataTypeParser, logger: Logger);
/**
* Checks input bindings and evaluates/updates them as needed
*
* @param bindings - A list of @Input() bindings
* @param context - The current context object
* @param parserConfig - The parser config
* @param options - The current ParseOptions
*/
checkInputBindings(bindings: {
[key: string]: RichBindingData;
}, context: any, parserConfig: SelectorHookParserConfig, options: ParseOptions): void;
/**
* We can detect if a binding needs to be reevaluated via the bound context variables. There are three cases to consider:
*
* a) If a binding does not use context vars, don't reevaluate (binding is static and won't ever need to be updated)
* b) If a binding does use context vars, but context vars haven't changed, don't reevaluate either (would evalute the same)
* c) If a binding uses context vars and they have changed, reevaluate the binding from scratch to get the new version
*
* This is in line with the standard Angular behavior when evaluating template vars like [input]="{prop: this.something}".
* When 'this.something' changes so that it returns false on a === comparison with its previous value, Angular does not
* simply replace the reference bound to 'prop', but recreates the whole object literal and passes a new reference into the
* input, triggering ngOnChanges.
*
* @param binding - The previous bindings
* @param context - The current context object
* @param parserConfig - The current parser config
*/
private updateInputBindingIfStale;
/**
* Checks output bindings and evaluates/updates them as needed
*
* @param bindings - A list of @Output() bindings
* @param parserConfig - The current parser config
* @param options - The current ParseOptions
*/
checkOutputBindings(bindings: {
[key: string]: RichBindingData;
}, parserConfig: SelectorHookParserConfig, options: ParseOptions): void;
static ɵfac: i0.ɵɵFactoryDeclaration<BindingsValueManager, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<BindingsValueManager>;
}