Skip to content

Commit

Permalink
Diagram - redesign (add history toolbar and view toolbar) (#11944)
Browse files Browse the repository at this point in the history
* Diagram - add history toolbar + viewSettings toolbar - first commit

* Diagram - commands refactoring

* Diagram - add an ability to check context menu items

* Diagram - context menus refactoring

* Diagram - context menu icons fix

* Diagram - fix select box commands

* Diagram - toolbars refactoring + tests

* Fix tests

* Fix tests

* Fix tests
  • Loading branch information
Roman Rodin authored Feb 11, 2020
1 parent 01e45e2 commit 7c29819
Show file tree
Hide file tree
Showing 30 changed files with 1,835 additions and 1,084 deletions.
2 changes: 1 addition & 1 deletion js/docEnums.js
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@

/**
* @typedef {string} Enums.DiagramToolbarCommand
* @enum {'separator'|'export'|'undo'|'redo'|'cut'|'copy'|'paste'|'selectAll'|'delete'|'fontName'|'fontSize'|'bold'|'italic'|'underline'|'fontColor'|'lineColor'|'fillColor'|'textAlignLeft'|'textAlignCenter'|'textAlignRight'|'lock'|'unlock'|'sendToBack'|'bringToFront'|'insertShapeImage'|'editShapeImage'|'deleteShapeImage'|'connectorLineType'|'connectorLineStart'|'connectorLineEnd'|'autoLayout'|'fullScreen'}
* @enum {'separator'|'export'|'undo'|'redo'|'cut'|'copy'|'paste'|'selectAll'|'delete'|'fontName'|'fontSize'|'bold'|'italic'|'underline'|'fontColor'|'lineColor'|'fillColor'|'textAlignLeft'|'textAlignCenter'|'textAlignRight'|'lock'|'unlock'|'sendToBack'|'bringToFront'|'insertShapeImage'|'editShapeImage'|'deleteShapeImage'|'connectorLineType'|'connectorLineStart'|'connectorLineEnd'|'autoLayout'|'fullScreen'|'zoomLevel'|'autoZoom'|'showGrid'|'snapToGrid'|'gridSize'|'units'}
*/

/**
Expand Down
20 changes: 18 additions & 2 deletions js/ui/diagram.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,23 @@ export interface dxDiagramOptions extends WidgetOptions<dxDiagram> {
* @prevFileNamespace DevExpress.ui
* @public
*/
toolbar?: { commands?: Array<'separator' | 'export' | 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'selectAll' | 'delete' | 'fontName' | 'fontSize' | 'bold' | 'italic' | 'underline' | 'fontColor' | 'lineColor' | 'fillColor' | 'textAlignLeft' | 'textAlignCenter' | 'textAlignRight' | 'lock' | 'unlock' | 'sendToBack' | 'bringToFront' | 'insertShapeImage' | 'editShapeImage' | 'deleteShapeImage' | 'connectorLineType' | 'connectorLineStart' | 'connectorLineEnd' | 'autoLayout' | 'fullScreen'>, visible?: boolean };
toolbar?: { commands?: Array<'separator' | 'export' | 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'selectAll' | 'delete' | 'fontName' | 'fontSize' | 'bold' | 'italic' | 'underline' | 'fontColor' | 'lineColor' | 'fillColor' | 'textAlignLeft' | 'textAlignCenter' | 'textAlignRight' | 'lock' | 'unlock' | 'sendToBack' | 'bringToFront' | 'insertShapeImage' | 'editShapeImage' | 'deleteShapeImage' | 'connectorLineType' | 'connectorLineStart' | 'connectorLineEnd' | 'autoLayout' | 'fullScreen' | 'zoomLevel' | 'autoZoom' | 'showGrid' | 'snapToGrid' | 'gridSize' | 'units'>, visible?: boolean };
/**
* @docid dxDiagramOptions.historyToolbar
* @type Object
* @default {}
* @prevFileNamespace DevExpress.ui
* @public
*/
historyToolbar?: { commands?: Array<'separator' | 'export' | 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'selectAll' | 'delete' | 'fontName' | 'fontSize' | 'bold' | 'italic' | 'underline' | 'fontColor' | 'lineColor' | 'fillColor' | 'textAlignLeft' | 'textAlignCenter' | 'textAlignRight' | 'lock' | 'unlock' | 'sendToBack' | 'bringToFront' | 'insertShapeImage' | 'editShapeImage' | 'deleteShapeImage' | 'connectorLineType' | 'connectorLineStart' | 'connectorLineEnd' | 'autoLayout' | 'fullScreen' | 'zoomLevel' | 'autoZoom' | 'showGrid' | 'snapToGrid' | 'gridSize' | 'units'>, visible?: boolean };
/**
* @docid dxDiagramOptions.viewToolbar
* @type Object
* @default {}
* @prevFileNamespace DevExpress.ui
* @public
*/
viewToolbar?: { commands?: Array<'separator' | 'export' | 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'selectAll' | 'delete' | 'fontName' | 'fontSize' | 'bold' | 'italic' | 'underline' | 'fontColor' | 'lineColor' | 'fillColor' | 'textAlignLeft' | 'textAlignCenter' | 'textAlignRight' | 'lock' | 'unlock' | 'sendToBack' | 'bringToFront' | 'insertShapeImage' | 'editShapeImage' | 'deleteShapeImage' | 'connectorLineType' | 'connectorLineStart' | 'connectorLineEnd' | 'autoLayout' | 'fullScreen' | 'zoomLevel' | 'autoZoom' | 'showGrid' | 'snapToGrid' | 'gridSize' | 'units'>, visible?: boolean };
/**
* @docid dxDiagramOptions.toolbox
* @type Object
Expand Down Expand Up @@ -356,4 +372,4 @@ interface JQuery {
export type Options = dxDiagramOptions;

/** @deprecated use Options instead */
export type IOptions = dxDiagramOptions;
export type IOptions = dxDiagramOptions;
13 changes: 13 additions & 0 deletions js/ui/diagram/diagram.bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ class DiagramBar {
isVisible() { // IBar.isVisible(): boolean
return true;
}

_getKeys(items) {
const keys = items.reduce((commands, item) => {
if(item.command !== undefined) {
commands.push(item.command);
}
if(item.items) {
commands = commands.concat(this._getKeys(item.items));
}
return commands;
}, []);
return keys;
}
}

module.exports = DiagramBar;
Loading

0 comments on commit 7c29819

Please sign in to comment.