New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/mgt-element

Package Overview
Dependencies
Maintainers
2
Versions
835
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/mgt-element - npm Package Compare versions

Comparing version 2.3.0-next.teamsprovider.b00c20b to 2.3.0-preview.07b40fa

5

dist/es6/components/templatedComponent.js

@@ -89,6 +89,7 @@ /**

div.dataset.generated = 'template';
TemplateHelper.renderTemplate(div, this.templates[templateType], context, Object.assign({}, this.templateContext));
const dataContext = Object.assign(Object.assign({}, context), this.templateContext);
TemplateHelper.renderTemplate(div, this.templates[templateType], dataContext);
this.appendChild(div);
this._renderedTemplates[slotName] = { context, slot: div };
this.fireCustomEvent('templateRendered', { templateType, context, element: div });
this.fireCustomEvent('templateRendered', { templateType, context: dataContext, element: div });
return template;

@@ -95,0 +96,0 @@ }

@@ -27,10 +27,2 @@ /**

graph: IGraph;
/**
* Enable/Disable multi account functionality
*
* @protected
* @type {boolean}
* @memberof IProvider
*/
protected isMultipleAccountDisabled: boolean;
private _state;

@@ -37,0 +29,0 @@ private _loginChangedDispatcher;

@@ -18,10 +18,2 @@ /**

constructor() {
/**
* Enable/Disable multi account functionality
*
* @protected
* @type {boolean}
* @memberof IProvider
*/
this.isMultipleAccountDisabled = true;
this._loginChangedDispatcher = new EventDispatcher();

@@ -28,0 +20,0 @@ this._activeAccountChangedDispatcher = new EventDispatcher();

3

dist/es6/utils/TemplateHelper.d.ts

@@ -30,5 +30,4 @@ /**

* @param context the data context to be applied
* @param additionalContext additional context that could contain functions to transform the data
*/
static renderTemplate(root: HTMLElement, template: HTMLTemplateElement, context: object, additionalContext?: object): void;
static renderTemplate(root: HTMLElement, template: HTMLTemplateElement, context: object): void;
/**

@@ -35,0 +34,0 @@ * Set an alternative binding syntax. Default is {{ <value> }}

@@ -30,5 +30,4 @@ /**

* @param context the data context to be applied
* @param additionalContext additional context that could contain functions to transform the data
*/
static renderTemplate(root, template, context, additionalContext) {
static renderTemplate(root, template, context) {
// inherit context from parent template

@@ -41,3 +40,3 @@ if (template.$parentTemplateContext) {

const templateContent = template.content.cloneNode(true);
rendered = this.renderNode(templateContent, root, context, additionalContext);
rendered = this.renderNode(templateContent, root, context);
}

@@ -50,3 +49,3 @@ else if (template.childNodes.length) {

}
rendered = this.renderNode(div, root, context, additionalContext);
rendered = this.renderNode(div, root, context);
}

@@ -70,3 +69,3 @@ if (rendered) {

const end = this.escapeRegex(this._endExpression);
this._expression = new RegExp(`${start}\\s*\([$\\w\\.()\\[\\]]+\)\\s*${end}`, 'g');
this._expression = new RegExp(`${start}\\s*([$\\w\\.,'"\\s()\\[\\]]+)\\s*${end}`, 'g');
}

@@ -109,5 +108,5 @@ /**

}
static expandExpressionsAsString(str, context, additionalContext) {
static expandExpressionsAsString(str, context) {
return str.replace(this.expression, (match, p1) => {
const value = this.evalInContext(p1 || this.trimExpression(match), Object.assign(Object.assign({}, context), additionalContext));
const value = this.evalInContext(p1 || this.trimExpression(match), context);
if (value) {

@@ -124,5 +123,5 @@ if (typeof value === 'object') {

}
static renderNode(node, root, context, additionalContext) {
static renderNode(node, root, context) {
if (node.nodeName === '#text') {
node.textContent = this.expandExpressionsAsString(node.textContent, context, additionalContext);
node.textContent = this.expandExpressionsAsString(node.textContent, context);
return node;

@@ -147,3 +146,3 @@ }

const key = keyValue[0].trim();
const value = this.evalInContext(keyValue[1].trim(), Object.assign(Object.assign({}, context), additionalContext));
const value = this.evalInContext(keyValue[1].trim(), context);
if (key.startsWith('@')) {

@@ -162,3 +161,3 @@ // event

else {
nodeElement.setAttribute(attribute.name, this.expandExpressionsAsString(attribute.value, context, additionalContext));
nodeElement.setAttribute(attribute.name, this.expandExpressionsAsString(attribute.value, context));
}

@@ -182,3 +181,3 @@ }

const expression = childElement.dataset.if;
if (!this.evalBoolInContext(this.trimExpression(expression), Object.assign(Object.assign({}, context), additionalContext))) {
if (!this.evalBoolInContext(this.trimExpression(expression), context)) {
removeChildren.push(childElement);

@@ -206,7 +205,7 @@ childWillBeRemoved = true;

else if (!childWillBeRemoved) {
this.renderNode(childNode, root, context, additionalContext);
this.renderNode(childNode, root, context);
}
}
else {
this.renderNode(childNode, root, context, additionalContext);
this.renderNode(childNode, root, context);
}

@@ -233,3 +232,3 @@ // clear the flag if the current node wasn't data-if

const listKey = loopTokens[2];
const list = this.evalInContext(listKey, Object.assign(Object.assign({}, context), additionalContext));
const list = this.evalInContext(listKey, context);
if (Array.isArray(list)) {

@@ -244,3 +243,3 @@ // first remove the child

const clone = childElement.cloneNode(true);
this.renderNode(clone, root, newContext, additionalContext);
this.renderNode(clone, root, newContext);
nodeElement.insertBefore(clone, childElement);

@@ -247,0 +246,0 @@ }

{
"name": "@microsoft/mgt-element",
"version": "2.3.0-next.teamsprovider.b00c20b",
"version": "2.3.0-preview.07b40fa",
"description": "Microsoft Graph Toolkit base classes",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/microsoftgraph/microsoft-graph-toolkit",

@@ -129,6 +129,6 @@ /**

TemplateHelper.renderTemplate(div, this.templates[templateType], context, {
...this.templateContext
});
const dataContext = { ...context, ...this.templateContext };
TemplateHelper.renderTemplate(div, this.templates[templateType], dataContext);
this.appendChild(div);

@@ -138,3 +138,3 @@

this.fireCustomEvent('templateRendered', { templateType, context, element: div });
this.fireCustomEvent('templateRendered', { templateType, context: dataContext, element: div });

@@ -141,0 +141,0 @@ return template;

@@ -29,10 +29,2 @@ /**

public graph: IGraph;
/**
* Enable/Disable multi account functionality
*
* @protected
* @type {boolean}
* @memberof IProvider
*/
protected isMultipleAccountDisabled: boolean = true;
private _state: ProviderState;

@@ -39,0 +31,0 @@ private _loginChangedDispatcher = new EventDispatcher<LoginChangedEvent>();

@@ -31,10 +31,4 @@ /**

* @param context the data context to be applied
* @param additionalContext additional context that could contain functions to transform the data
*/
public static renderTemplate(
root: HTMLElement,
template: HTMLTemplateElement,
context: object,
additionalContext?: object
) {
public static renderTemplate(root: HTMLElement, template: HTMLTemplateElement, context: object) {
// inherit context from parent template

@@ -49,3 +43,3 @@ if ((template as any).$parentTemplateContext) {

const templateContent = template.content.cloneNode(true);
rendered = this.renderNode(templateContent, root, context, additionalContext);
rendered = this.renderNode(templateContent, root, context);
} else if (template.childNodes.length) {

@@ -57,3 +51,3 @@ const div = document.createElement('div');

}
rendered = this.renderNode(div, root, context, additionalContext);
rendered = this.renderNode(div, root, context);
}

@@ -81,3 +75,3 @@

this._expression = new RegExp(`${start}\\s*\([$\\w\\.()\\[\\]]+\)\\s*${end}`, 'g');
this._expression = new RegExp(`${start}\\s*([$\\w\\.,'"\\s()\\[\\]]+)\\s*${end}`, 'g');
}

@@ -135,5 +129,5 @@

private static expandExpressionsAsString(str: string, context: object, additionalContext: object) {
private static expandExpressionsAsString(str: string, context: object) {
return str.replace(this.expression, (match, p1) => {
const value = this.evalInContext(p1 || this.trimExpression(match), { ...context, ...additionalContext });
const value = this.evalInContext(p1 || this.trimExpression(match), context);
if (value) {

@@ -150,5 +144,5 @@ if (typeof value === 'object') {

private static renderNode(node: Node, root: HTMLElement, context: object, additionalContext: object) {
private static renderNode(node: Node, root: HTMLElement, context: object) {
if (node.nodeName === '#text') {
node.textContent = this.expandExpressionsAsString(node.textContent, context, additionalContext);
node.textContent = this.expandExpressionsAsString(node.textContent, context);
return node;

@@ -175,3 +169,3 @@ } else if (node.nodeName === 'TEMPLATE') {

const key = keyValue[0].trim();
const value = this.evalInContext(keyValue[1].trim(), { ...context, ...additionalContext });
const value = this.evalInContext(keyValue[1].trim(), context);

@@ -189,6 +183,3 @@ if (key.startsWith('@')) {

} else {
nodeElement.setAttribute(
attribute.name,
this.expandExpressionsAsString(attribute.value, context, additionalContext)
);
nodeElement.setAttribute(attribute.name, this.expandExpressionsAsString(attribute.value, context));
}

@@ -217,3 +208,3 @@ }

const expression = childElement.dataset.if;
if (!this.evalBoolInContext(this.trimExpression(expression), { ...context, ...additionalContext })) {
if (!this.evalBoolInContext(this.trimExpression(expression), context)) {
removeChildren.push(childElement);

@@ -238,6 +229,6 @@ childWillBeRemoved = true;

} else if (!childWillBeRemoved) {
this.renderNode(childNode, root, context, additionalContext);
this.renderNode(childNode, root, context);
}
} else {
this.renderNode(childNode, root, context, additionalContext);
this.renderNode(childNode, root, context);
}

@@ -270,3 +261,3 @@

const list = this.evalInContext(listKey, { ...context, ...additionalContext });
const list = this.evalInContext(listKey, context);
if (Array.isArray(list)) {

@@ -286,3 +277,3 @@ // first remove the child

const clone = childElement.cloneNode(true);
this.renderNode(clone, root, newContext, additionalContext);
this.renderNode(clone, root, newContext);
nodeElement.insertBefore(clone, childElement);

@@ -289,0 +280,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc