How to use adaptivecards-templating - 6 common examples

To help you get started, we’ve selected a few adaptivecards-templating examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / AdaptiveCards / source / nodejs / adaptivecards-designer / src / sample-picker-dialog.ts View on Github external
type: "ActionSet",
                    horizontalAlignment: "right",
                    actions: [
                        {
                            type: "Action.Submit",
                            id: "cancel",
                            title: "Cancel"
                        }
                    ]
                }
            ]
        };

        let template = new ACData.Template(templatePayload);
        
        let context = new ACData.EvaluationContext();
        context.$root = {
            title: this.title,
            message: message
        };

        let expandedCardPayload = template.expand(context);

        let card = new Adaptive.AdaptiveCard();
        card.hostConfig = defaultHostConfig;
        card.onExecuteAction = (action: Adaptive.Action) => {
            if (action.id == "cancel") {
                this.close();
            }
        }

        card.parse(expandedCardPayload);
github microsoft / AdaptiveCards / source / nodejs / adaptivecards-designer / src / open-sample-dialog.ts View on Github external
this.entry.onDownloaded = (sender: CatalogueEntry) => {
            thumbnailHost.removeChild(spinner);

            if (sender.cardPayloadDownloaded) {
                let cardPayload = JSON.parse(sender.cardPayload);

                if (sender.sampleData) {
                    let template = new ACData.Template(cardPayload);

                    let evaluationContext = new ACData.EvaluationContext();
                    evaluationContext.$root = JSON.parse(sender.sampleData);

                    cardPayload = template.expand(evaluationContext);
                }

                let card = new Adaptive.AdaptiveCard();
                card.parse(cardPayload);
                card.render();
                card.renderedElement.style.width = "100%";

                thumbnailHost.appendChild(card.renderedElement);
            }
            else {
                let errorMessage = document.createElement("div");
                errorMessage.className = "acd-dialog-message";
                errorMessage.innerText = "Preview not available";
github microsoft / AdaptiveCards / source / nodejs / adaptivecards-designer / src / sample-picker-dialog.ts View on Github external
type: "ActionSet",
                    horizontalAlignment: "right",
                    actions: [
                        {
                            type: "Action.Submit",
                            id: "cancel",
                            title: "Cancel"
                        }
                    ]
                }
            ]
        };

        let template = new ACData.Template(templatePayload);
        
        let context = new ACData.EvaluationContext();
        context.$root = {
            title: this.title,
            catalogue: catalogue
        };

        let expandedCardPayload = template.expand(context);

        let card = new Adaptive.AdaptiveCard();
        card.hostConfig = defaultHostConfig;
        card.onExecuteAction = (action: Adaptive.Action) => {
            if (action.id == "cancel") {
                this.close();
            }
            else if (action instanceof Adaptive.SubmitAction) {
                this._selectedSample = catalogue[action.data["catalogueIndex"]];
github microsoft / AdaptiveCards / source / nodejs / adaptivecards-designer / src / sample-picker-dialog.ts View on Github external
},
                {
                    type: "ActionSet",
                    horizontalAlignment: "right",
                    actions: [
                        {
                            type: "Action.Submit",
                            id: "cancel",
                            title: "Cancel"
                        }
                    ]
                }
            ]
        };

        let template = new ACData.Template(templatePayload);
        
        let context = new ACData.EvaluationContext();
        context.$root = {
            title: this.title,
            message: message
        };

        let expandedCardPayload = template.expand(context);

        let card = new Adaptive.AdaptiveCard();
        card.hostConfig = defaultHostConfig;
        card.onExecuteAction = (action: Adaptive.Action) => {
            if (action.id == "cancel") {
                this.close();
            }
        }
github microsoft / AdaptiveCards / source / nodejs / adaptivecards-designer / src / open-sample-dialog.ts View on Github external
this.entry.onDownloaded = (sender: CatalogueEntry) => {
            thumbnailHost.removeChild(spinner);

            if (sender.cardPayloadDownloaded) {
                let cardPayload = JSON.parse(sender.cardPayload);

                if (sender.sampleData) {
                    let template = new ACData.Template(cardPayload);

                    let evaluationContext = new ACData.EvaluationContext();
                    evaluationContext.$root = JSON.parse(sender.sampleData);

                    cardPayload = template.expand(evaluationContext);
                }

                let card = new Adaptive.AdaptiveCard();
                card.parse(cardPayload);
                card.render();
                card.renderedElement.style.width = "100%";

                thumbnailHost.appendChild(card.renderedElement);
            }
            else {
                let errorMessage = document.createElement("div");
github microsoft / AdaptiveCards / source / nodejs / adaptivecards-designer / src / sample-picker-dialog.ts View on Github external
},
                {
                    type: "ActionSet",
                    horizontalAlignment: "right",
                    actions: [
                        {
                            type: "Action.Submit",
                            id: "cancel",
                            title: "Cancel"
                        }
                    ]
                }
            ]
        };

        let template = new ACData.Template(templatePayload);
        
        let context = new ACData.EvaluationContext();
        context.$root = {
            title: this.title,
            catalogue: catalogue
        };

        let expandedCardPayload = template.expand(context);

        let card = new Adaptive.AdaptiveCard();
        card.hostConfig = defaultHostConfig;
        card.onExecuteAction = (action: Adaptive.Action) => {
            if (action.id == "cancel") {
                this.close();
            }
            else if (action instanceof Adaptive.SubmitAction) {

adaptivecards-templating

Adaptive Card data binding and templating engine for JavaScript

MIT
Latest version published 2 years ago

Package Health Score

72 / 100
Full package analysis