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.
62 lines (61 loc) • 2.61 kB
TypeScript
import { SavedBindings } from '../../../interfaces';
import { HookParser, HookPosition, HookValue, HookComponentData, HookBindings } from '../../../interfacesPublic';
import { TagHookFinder } from './tagHookFinder';
import { BindingsValueManager } from '../bindingsValueManager';
import { SelectorHookParserConfig } from '../selectorHookParserConfig';
import { SelectorHookParserConfigResolver } from '../selectorHookParserConfigResolver';
import { ParseOptions } from '../../../services/settings/options';
/**
* A text parser to load components with their bindings like in Angular templates.
*/
export declare class TextSelectorHookParser implements HookParser {
private configResolver;
private tagHookFinder;
private bindingsValueManager;
name: string | undefined;
config: SelectorHookParserConfig;
savedBindings: {
[key: number]: SavedBindings;
};
constructor(config: SelectorHookParserConfig, configResolver: SelectorHookParserConfigResolver, tagHookFinder: TagHookFinder, bindingsValueManager: BindingsValueManager);
findHooks(content: string, context: any, options: ParseOptions): HookPosition[];
loadComponent(hookId: number, hookValue: HookValue, context: any, childNodes: any[], options: ParseOptions): HookComponentData;
getBindings(hookId: number, hookValue: HookValue, context: any, options: ParseOptions): HookBindings;
/**
* Returns RichBindingData for Angular-style inputs & output attrs from an openingTag
*
* @param openingTag - The openingTag to inspect
*/
createBindings(openingTag: string): SavedBindings;
/**
* Collects Angular-style inputs from an openingTag
*
* @param openingTag - The openingTag to inspect
*/
collectRawInputs(openingTag: string): {
[key: string]: any;
};
/**
* Collects Angular-style outputs from an openingTag
*
* @param openingTag - The openingTag to inspect
*/
collectRawOutputs(openingTag: string): {
[key: string]: any;
};
/**
* Collects Angular-style inputs or outputs from an openingTag
*
* @param type - What kind of bindings to extract
* @param openingTag - The opening tag to inspect
* @param blacklist - A list of inputs/outputs to blacklist
* @param whitelist - A list of inputs/outputs to whitelist
*/
private getBindingsFromOpeningTag;
/**
* Transforms a RichBindingData object into a normal bindings object
*
* @param richBindingsObject - The object containing the RichBindingData
*/
private getValuesFromSavedBindings;
}