Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion samples/v1.0/Elements/Action.ShowCard.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
"actions": [
{
"type": "Action.Submit",
"title": "Neat!"
"title": "Neat!",
"data": {
"neat": "true"
}
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions samples/v1.0/Elements/Column.SelectAction.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
],
"selectAction": {
"type": "Action.OpenUrl",
"tooltip": "cool link",
"tooltip": "another cool link",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
},
Expand All @@ -61,7 +61,7 @@
],
"selectAction": {
"type": "Action.OpenUrl",
"tooltip": "cool link",
"tooltip": "a third cool link",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
}
Expand Down
13 changes: 12 additions & 1 deletion source/nodejs/adaptivecards-designer-app/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
<!doctype html><html><head><title>Adaptive Cards Designer</title><script defer="defer" src="adaptivecards-designer-app.min.js"></script><link href="adaptivecards-designer-app.css" rel="stylesheet"></head><body><div id="designerRootHost"></div></body></html>
<!DOCTYPE html>
<html>

<head>
<title>Adaptive Cards Designer</title>
<script defer src="adaptivecards-designer-app.js"></script></head>

<body>
<div id="designerRootHost"></div>
</body>

</html>
7 changes: 6 additions & 1 deletion source/nodejs/adaptivecards-ui-testapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ <h1>Adaptive Cards UI Test App</h1>
<div id="renderedCardSpace"> </div>
</div>

<div id="retrievedInputsDiv"></div>
<div class="inputsDiv" id="inputsDiv">
<div id="hideInputsDiv">
<button id="hideInputsBtn">Hide Inputs</button>
</div>
<div id="retrievedInputsDiv"></div>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ body {
}

.main {
width: 80vw;
width: 60vw;
height: 100vh;
}

.testCasesDiv {
width: 20vw;
width: 40vw;
height: 100vh;
}

Expand All @@ -31,13 +31,24 @@ body {
height: 80vh;
}

#retrievedInputsDiv
.inputsDiv
{
display: flex;
width: 100vw;
height: 20vh;
background-color: rgb(240, 238, 238);
}

#hideInputsDiv
{
width: 10vw;
}

#retrievedInputsDiv
{
width: 90vw;
}

#renderedCardSpace
{
width: 600px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ function renderTestCasesList() {
});
}

function hideInputsDiv() {
const retrievedInputsDiv = document.getElementById("retrievedInputsDiv");
retrievedInputsDiv.style.visibility = "hidden";
}

window.onload = () => {
renderTestCasesList();

Expand Down Expand Up @@ -47,4 +52,7 @@ window.onload = () => {
};

renderCard(card, cardRenderedCallback);

const hideInputsButton = document.getElementById("hideInputsBtn");
hideInputsButton.addEventListener("click", (e: Event) => { hideInputsDiv() });
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const v10TestCases: string[] = ['Scenarios/ActivityUpdate'];
const v10TestCases: string[] = [
'Scenarios/ActivityUpdate',
'Elements/Container.SelectAction',
'Elements/Column.SelectAction',
'Elements/ColumnSet.SelectAction',
'Elements/Image.SelectAction',
'Elements/Action.ShowCard'];
const v11TestCases: string[] = [];
const v12TestCases: string[] = [];
const v13TestCases: string[] = ['Elements/Input.Text.ErrorMessage'];
const v13TestCases: string[] = [
'Elements/Input.Text.ErrorMessage',
'Elements/Input.Number.ErrorMessage',
'Elements/Input.ChoiceSet.ErrorMessage',
'Elements/Input.Time.ErrorMessage',
'Elements/Input.Toggle.ErrorMessage'
];
const v14TestCases: string[] = [];
const v15TestCases: string[] = [];
const v16TestCases: string[] = [
Expand Down
20 changes: 15 additions & 5 deletions source/nodejs/adaptivecards-ui-testapp/src/rendering-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { getTestCasesList } from "./file-retriever-utils";
import { Action, AdaptiveCard, ExecuteAction, HostConfig, IMarkdownProcessingResult, Input, OpenUrlAction, SerializationContext, SubmitAction, Version, Versions } from "adaptivecards";
import { Action, AdaptiveCard, ExecuteAction, HostConfig, IMarkdownProcessingResult, Input, OpenUrlAction, PropertyBag, SerializationContext, SubmitAction, Version, Versions } from "adaptivecards";
import * as Remarkable from "remarkable";

export function listAllFiles(): HTMLLIElement[] {
Expand Down Expand Up @@ -33,8 +33,8 @@ export function listAllFiles(): HTMLLIElement[] {
}

export async function readAndRenderCard(fileName: string, callbackFunction: Function) {
const retrievedInputsDiv: HTMLElement = document.getElementById("renderedCardSpace");
retrievedInputsDiv.style.visibility = "hidden";
const renderedCardSpaceDiv: HTMLElement = document.getElementById("renderedCardSpace");
renderedCardSpaceDiv.style.visibility = "hidden";

const response = await fetch(`samples/${fileName}`);

Expand All @@ -59,8 +59,6 @@ export async function readAndRenderCard(fileName: string, callbackFunction: Func
}

renderCard(jsonToRender, callbackFunction);

retrievedInputsDiv.style.visibility = "visible";
}

export function renderCard(cardJson: any, callbackFunction: Function): void {
Expand Down Expand Up @@ -89,6 +87,16 @@ export function renderCard(cardJson: any, callbackFunction: Function): void {
inputsMap[input.id] = input.value;
});

if (actionType === SubmitAction.JsonTypeName)
{
const submitAction = action as SubmitAction;

for (const [key, value] of Object.entries(submitAction.data))
{
inputsMap[key] = value;
}
}

inputsAsJson = JSON.stringify(inputsMap);
}
else if (actionType === OpenUrlAction.JsonTypeName) {
Expand All @@ -98,6 +106,7 @@ export function renderCard(cardJson: any, callbackFunction: Function): void {

const retrievedInputsDiv: HTMLElement = document.getElementById("retrievedInputsDiv");
retrievedInputsDiv.innerHTML = inputsAsJson;
retrievedInputsDiv.style.visibility = "visible";
};

// For markdown support you need a third-party library
Expand All @@ -122,4 +131,5 @@ export function cardRenderedCallback(renderedCard: HTMLElement) {
const renderedCardDiv = document.getElementById("renderedCardSpace");
renderedCardDiv.innerHTML = "";
renderedCardDiv.appendChild(renderedCard);
renderedCardDiv.style.visibility = "visible";
}
Loading