@phosphor/widgets
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -241,2 +241,10 @@ import { ReadonlyJSONObject } from '@phosphor/coreutils'; | ||
/** | ||
* The icon class for the command item. | ||
*/ | ||
readonly iconClass: string; | ||
/** | ||
* The icon label for the command item. | ||
*/ | ||
readonly iconLabel: string; | ||
/** | ||
* The extra class name for the command item. | ||
@@ -366,10 +374,18 @@ */ | ||
/** | ||
* Render the shortcut for a command palette item. | ||
* Render the icon for a command palette item. | ||
* | ||
* @param data - The data to use for rendering the shortcut. | ||
* @param data - The data to use for rendering the icon. | ||
* | ||
* @returns A virtual element representing the shortcut. | ||
* @returns A virtual element representing the icon. | ||
*/ | ||
renderItemShortcut(data: IItemRenderData): VirtualElement; | ||
renderItemIcon(data: IItemRenderData): VirtualElement; | ||
/** | ||
* Render the content for a command palette item. | ||
* | ||
* @param data - The data to use for rendering the content. | ||
* | ||
* @returns A virtual element representing the content. | ||
*/ | ||
renderItemContent(data: IItemRenderData): VirtualElement; | ||
/** | ||
* Render the label for a command palette item. | ||
@@ -391,2 +407,10 @@ * | ||
/** | ||
* Render the shortcut for a command palette item. | ||
* | ||
* @param data - The data to use for rendering the shortcut. | ||
* | ||
* @returns A virtual element representing the shortcut. | ||
*/ | ||
renderItemShortcut(data: IItemRenderData): VirtualElement; | ||
/** | ||
* Create the class name for the command palette item. | ||
@@ -408,2 +432,10 @@ * | ||
/** | ||
* Create the class name for the command item icon. | ||
* | ||
* @param data - The data to use for the class name. | ||
* | ||
* @returns The full class name for the item icon. | ||
*/ | ||
createIconClass(data: IItemRenderData): string; | ||
/** | ||
* Create the render content for the header node. | ||
@@ -410,0 +442,0 @@ * |
@@ -464,3 +464,3 @@ "use strict"; | ||
var dataset = this.createItemDataset(data); | ||
return (virtualdom_1.h.li({ className: className, dataset: dataset }, this.renderItemShortcut(data), this.renderItemLabel(data), this.renderItemCaption(data))); | ||
return (virtualdom_1.h.li({ className: className, dataset: dataset }, this.renderItemIcon(data), this.renderItemContent(data), this.renderItemShortcut(data))); | ||
}; | ||
@@ -479,13 +479,23 @@ /** | ||
/** | ||
* Render the shortcut for a command palette item. | ||
* Render the icon for a command palette item. | ||
* | ||
* @param data - The data to use for rendering the shortcut. | ||
* @param data - The data to use for rendering the icon. | ||
* | ||
* @returns A virtual element representing the shortcut. | ||
* @returns A virtual element representing the icon. | ||
*/ | ||
Renderer.prototype.renderItemShortcut = function (data) { | ||
var content = this.formatItemShortcut(data); | ||
return virtualdom_1.h.div({ className: 'p-CommandPalette-itemShortcut' }, content); | ||
Renderer.prototype.renderItemIcon = function (data) { | ||
var className = this.createIconClass(data); | ||
return virtualdom_1.h.div({ className: className }, data.item.iconLabel); | ||
}; | ||
/** | ||
* Render the content for a command palette item. | ||
* | ||
* @param data - The data to use for rendering the content. | ||
* | ||
* @returns A virtual element representing the content. | ||
*/ | ||
Renderer.prototype.renderItemContent = function (data) { | ||
return (virtualdom_1.h.div({ className: 'p-CommandPalette-itemContent' }, this.renderItemLabel(data), this.renderItemCaption(data))); | ||
}; | ||
/** | ||
* Render the label for a command palette item. | ||
@@ -513,2 +523,13 @@ * | ||
/** | ||
* Render the shortcut for a command palette item. | ||
* | ||
* @param data - The data to use for rendering the shortcut. | ||
* | ||
* @returns A virtual element representing the shortcut. | ||
*/ | ||
Renderer.prototype.renderItemShortcut = function (data) { | ||
var content = this.formatItemShortcut(data); | ||
return virtualdom_1.h.div({ className: 'p-CommandPalette-itemShortcut' }, content); | ||
}; | ||
/** | ||
* Create the class name for the command palette item. | ||
@@ -552,2 +573,14 @@ * | ||
/** | ||
* Create the class name for the command item icon. | ||
* | ||
* @param data - The data to use for the class name. | ||
* | ||
* @returns The full class name for the item icon. | ||
*/ | ||
Renderer.prototype.createIconClass = function (data) { | ||
var name = 'p-CommandPalette-itemIcon'; | ||
var extra = data.item.iconClass; | ||
return extra ? name + " " + extra : name; | ||
}; | ||
/** | ||
* Create the render content for the header node. | ||
@@ -944,2 +977,22 @@ * | ||
}); | ||
Object.defineProperty(CommandItem.prototype, "iconClass", { | ||
/** | ||
* The icon class for the command item. | ||
*/ | ||
get: function () { | ||
return this._commands.iconClass(this.command, this.args); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CommandItem.prototype, "iconLabel", { | ||
/** | ||
* The icon label for the command item. | ||
*/ | ||
get: function () { | ||
return this._commands.iconLabel(this.command, this.args); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CommandItem.prototype, "caption", { | ||
@@ -946,0 +999,0 @@ /** |
@@ -16,2 +16,3 @@ export * from './boxengine'; | ||
export * from './scrollbar'; | ||
export * from './singletonlayout'; | ||
export * from './splitlayout'; | ||
@@ -18,0 +19,0 @@ export * from './splitpanel'; |
@@ -28,2 +28,3 @@ "use strict"; | ||
__export(require("./scrollbar")); | ||
__export(require("./singletonlayout")); | ||
__export(require("./splitlayout")); | ||
@@ -30,0 +31,0 @@ __export(require("./splitpanel")); |
{ | ||
"name": "@phosphor/widgets", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "PhosphorJS - Widgets", | ||
@@ -17,3 +17,3 @@ "main": "lib/index.js", | ||
"@phosphor/algorithm": "^1.1.2", | ||
"@phosphor/commands": "^1.4.0", | ||
"@phosphor/commands": "^1.5.0", | ||
"@phosphor/coreutils": "^1.3.0", | ||
@@ -20,0 +20,0 @@ "@phosphor/disposable": "^1.1.2", |
Sorry, the diff of this file is not supported yet
763404
61
21631
Updated@phosphor/commands@^1.5.0