@microsoft/mgt
Version:
The Microsoft Graph Toolkit
44 lines (43 loc) • 1.6 kB
TypeScript
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
export declare class TemplateHelper {
/**
* Render a template into a HTMLElement with the appropriate data context
*
* Ex:
* ```
* <template>
* <div>{{myObj.someStr}}</div>
* <div data-for="key in myObj.list">
* <div>{{key.anotherStr}}</div>
* </div>
* </template>
* ```
*
* @param template the template to render
* @param context the data context to be applied
* @param converters the converter functions used to transform the data
*/
static renderTemplate(template: HTMLTemplateElement, context: object, converters?: object): Node;
private static _expression;
private static _converterExpression;
/**
* Gets the value of an expanded key in an object
*
* Ex:
* ```
* let value = getValueFromObject({d: 3, a: {b: {c: 5}}}, 'a.b.c')
* ```
* @param obj the object holding the value (ex: {d: 3, a: {b: {c: 5}}})
* @param key the key of the value we need (ex: 'a.b.c')
*/
private static getValueFromObject;
private static replaceExpression;
private static renderNode;
private static evalBoolInContext;
private static evalInContext;
}