-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added new DialogStateManager * Added defaultValue to getValue * Added state manager tests * Latest changes * Ported DialogStateManager from C3 * More robust path parsing... * Added event emitting support Also implemented logic to cascade cancel to parent dialogs * Updated dialog set to support auto id's and dependencies also replaced "null" with "undefined" htroughout code * Updated unit tests * Added unit test for scopes and path resolvers Fixed issues as detected. * Added a bunch of dialog state tests * Added additional unit tests - Increased code coverage for DialogStateManager - Fixed issue detected from unit tests. * Tweaked settings test * Made DialogContainer.dialogs public * Fixed code review comment.
- Loading branch information
Showing
42 changed files
with
3,193 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* @module botbuilder-dialogs | ||
*/ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
/** | ||
* Base class for all configurable classes. | ||
*/ | ||
export abstract class Configurable { | ||
/** | ||
* Fluent method for configuring the object. | ||
* @param config Configuration settings to apply. | ||
*/ | ||
public configure(config: object): this { | ||
for (const key in config) { | ||
if (config.hasOwnProperty(key)) { | ||
const setting = config[key]; | ||
if (Array.isArray(setting)) { | ||
if (Array.isArray(this[key])) { | ||
// Apply as an array update | ||
setting.forEach((item) => this[key].push(item)); | ||
} else { | ||
this[key] = setting; | ||
} | ||
} else if (typeof setting == 'object') { | ||
if (typeof this[key] == 'object') { | ||
// Apply as a map update | ||
for (const child in setting) { | ||
if (setting.hasOwnProperty(child)) { | ||
this[key][child] = setting[child]; | ||
} | ||
} | ||
} else { | ||
this[key] = setting; | ||
} | ||
} else if (setting !== undefined) { | ||
this[key] = setting; | ||
} | ||
} | ||
} | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* @module botbuilder-dialogs | ||
*/ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
import { Dialog } from './dialog'; | ||
import { DialogSet } from './dialogSet'; | ||
import { DialogContext } from './dialogContext'; | ||
|
||
export abstract class DialogContainer<O extends object = {}> extends Dialog<O> { | ||
/** | ||
* The containers dialog set. | ||
*/ | ||
public readonly dialogs = new DialogSet(undefined); | ||
|
||
/** | ||
* Creates an inner dialog context for the containers active child. | ||
* @param dc Parents dialog context. | ||
* @returns A new dialog context for the active child or `undefined` if there is no active child. | ||
*/ | ||
public abstract createChildContext(dc: DialogContext): DialogContext | undefined; | ||
|
||
/** | ||
* Finds a child dialog that was previously added to the container. | ||
* @param dialogId ID of the dialog to lookup. | ||
*/ | ||
public findDialog(dialogId: string): Dialog | undefined { | ||
return this.dialogs.find(dialogId); | ||
} | ||
} |
Oops, something went wrong.